Commit Graph

26961 Commits

Author SHA1 Message Date
bors
2271b82007 Auto merge of #16264 - roife:refactor/refactor-generate-delegate-trait, r=Veykril
internal: clean and enhance readability for `generate_delegate_trait`

Continue from #16112

This PR primarily involves some cleanup and simple refactoring work, including:

- Adding numerous comments to layer the code and explain the behavior of each step.
- Renaming some variables to make them more sensible.
- Simplify certain operations using a more elegant approach.

The goal is to make this intricate implementation clearer and facilitate future maintenance.

In addition to this, the PR also removes redundant `path_transform` operations for `type_gen_args`.
Taking the example of `impl Trait<T1> for S<S1>`, where `S1` is considered. The struct `S` must be in the file where the user triggers code actions, so there's no need for the `path_transform`. Furthermore, before performing the transform, we've already renamed `S1`, ensuring it won't clash with existing generics parameters. Therefore, there's no need to transform it.
2024-01-05 13:37:54 +00:00
bors
59457091bb Auto merge of #16199 - Young-Flash:extract_struct_with_Self, r=Veykril
fix: `extract_struct_from_enum_variant` assist should resolve Self generic arg

close https://github.com/rust-lang/rust-analyzer/issues/16197
2024-01-05 13:26:34 +00:00
bors
2980d54160 Auto merge of #16223 - Young-Flash:quickfix_redundant_assoc_item, r=Veykril
feat: add quickfix for redundant_assoc_item diagnostic

Happy New Year 😊

follow up https://github.com/rust-lang/rust-analyzer/pull/15990, now it's time to close https://github.com/rust-lang/rust-analyzer/issues/15958, closes https://github.com/rust-lang/rust-analyzer/issues/16269

![demo](https://github.com/rust-lang/rust-analyzer/assets/71162630/74022c52-1566-49a0-9be8-03b82f3e730f)

EDIT: add a demo.git would be more illustrated when making release change log.
2024-01-05 13:15:01 +00:00
bors
1c6755cad0 Auto merge of #16213 - davidsemakula:guide-typos-urls, r=lnicola
chore: update docs/dev/guide.md based on 2024-01-01 release

Updates dev guide based on 2024-01-01 release
2024-01-05 13:03:41 +00:00
bors
af102bab0e Auto merge of #16270 - Veykril:flyimport-perf, r=Veykril
internal: Speed up import searching some more

Pushes the sorting to the caller, meaning additional filtering can be done pre-sorting. Similarly a collect call was pushed to the caller for allowing some other filters to run pre-collecting.
2024-01-05 12:03:02 +00:00
Lukas Wirth
cc2b79feeb internal: Speed up import searching some more 2024-01-05 12:58:20 +01:00
bors
dc31cef5fc Auto merge of #16268 - Veykril:method-trait-completion-limit, r=Veykril
Remove completion limit for trait importing method completions

Fixes https://github.com/rust-lang/rust-analyzer/issues/16075

The < 3 char limit never applied to methods and the amount of completions generated due this is not absolutely massive as not all traits in a project are ever applicable so there is little reason to employ the limit here. Especially as it limits the number of traits we consider, not items (after my changes yesterday), and the number of traits is not the slowing factor here. Tested this in r-a where we have ~800 traits project wide and even when ~260 are applicable there was no noticable slow down from it.
2024-01-05 11:14:37 +00:00
Lukas Wirth
4f75e0f910 Remove completion limit for trait importing method completions 2024-01-05 12:03:08 +01:00
bors
11b0126679 Auto merge of #16267 - Veykril:import-map-fix, r=Veykril
internal: Deduplicate some code
2024-01-05 10:43:52 +00:00
Lukas Wirth
d60638e5e6 Deduplicate some code 2024-01-05 11:34:18 +01:00
bors
28e4a9a205 Auto merge of #16262 - paul-jewell:gentoo-instruction-tuneup, r=lnicola
Further tuning of the Gentoo installation instructions.

Based on feedback from the Gentoo repository maintainer, addition of the possibility to install rust-analyzer via rustup.
2024-01-05 10:32:33 +00:00
Laurențiu Nicola
03ec0087a0 Tweak wording a little more 2024-01-05 10:24:39 +02:00
roife
fbdc59c54a internal: remove unnecessary path_tranform on type_gen_args in generate_delegate_trait. 2024-01-05 13:59:44 +08:00
roife
bf0c4acef4 internal: refactor generate_delegate_trait and add comments 2024-01-05 13:59:34 +08:00
davidsemakula
7c259a0300 fix typos and update descriptions 2024-01-05 01:56:06 +03:00
Paul Jewell
443787fe6a Added reference to the binaries available from GitHub.
In addition to installing from source.
2024-01-04 21:37:07 +00:00
Paul Jewell
0d6ec9c987 Further tuning of the Gentoo installation instructions.
based on feedback from the Gentoo repository maintainer, addition of
the possibility to install rust-analyzer via rustup.
2024-01-04 21:16:03 +00:00
bors
c84352a346 Auto merge of #16261 - Veykril:import-map-fix, r=Veykril
internal: Move query limits to the caller

Prior we calculated up to `limit` entries from a query, then filtered from that leaving us with less entries than the limit in some cases (which might give odd completion behavior due to items disappearing). This changes it so we filter before checking the limit.
2024-01-04 18:27:38 +00:00
Lukas Wirth
2666349392 Remove limit from symbol_index::Query 2024-01-04 19:20:10 +01:00
Lukas Wirth
0af780ea3e Fix symbol_index::Query::search_maps not adhering to case-sensitivity correctly 2024-01-04 19:12:56 +01:00
davidsemakula
f098123122 update docs/dev/guide.md based on 2024-01-01 release 2024-01-04 20:57:50 +03:00
bors
a795f4836c Auto merge of #16260 - Urhengulas:ide-diagnostics-refactor-tests, r=lnicola
internal: Replace only occurence of `check_expect` with `check_diagnostics`

Part of https://github.com/rust-lang/rust-analyzer/issues/14268.
2024-01-04 17:24:57 +00:00
Johann Hemmann
03b1ecd90d Replace only occurence of check_expect with check_diagnostics 2024-01-04 18:20:38 +01:00
Lukas Wirth
c3a29e5528 Remove limit from import_map::Query 2024-01-04 18:12:25 +01:00
bors
e88788ea70 Auto merge of #16258 - Veykril:import-map-fix, r=Veykril
internal: Rewrite `ImportMap::search_dependencies`

Second attempt, this time with a lot of perf improvements

Fixes https://github.com/rust-lang/rust-analyzer/issues/16080
Fixes https://github.com/rust-lang/rust-analyzer/issues/16074
Fixes https://github.com/rust-lang/rust-analyzer/issues/15845

The main bottleneck for flyimport completions are now import path calculation and completion item rendering.
2024-01-04 16:29:25 +00:00
Lukas Wirth
9b3052104c internal: Rewrite ImportMap::search_dependencies 2024-01-04 17:26:00 +01:00
bors
a2aab001a7 Auto merge of #16241 - Nilstrieb:sysrooting, r=Veykril
Give a userful error when rustc cannot be found in explicit sysroot

Somehow r-a believed that my sysroot was something weird with no rustc. Probably a me issue, but it was impossible to diagnose since r-a just gave me a plain "No such file or directory". Adding this error makes it clear what happened and allows diagnosing the problem.
2024-01-04 14:10:57 +00:00
bors
7f75815ca2 Auto merge of #16252 - Urhengulas:dont-assert-debug, r=Veykril
internal: Switch to `expected.assert_eq` for `ide` tests

This PR switches from `assert_debug_eq` to `assert_eq` and only compares parts of the result and not the whole. The aim is to only compare parts which are relevant to the test and also make it more readable.

Part of #14268.

## Questions
- [x] Can I use `Vec`? If not, what is the alternative?
    I assume I cannot because of: c3a00b5468/docs/dev/architecture.md (L413)
- [x] Should I group it by file, as proposed by Lukas?
    ```
    file_id 1:
        source_file_edits:
            - Indel { insert: "foo2", delete: 4..7 }

    file_id 2:
        file_system_edits:
            MoveFile AnchoredPathBuf { anchor: FileId(2), path: "foo2.rs", }
    ```
- [x] Is it okay to ignore `CreateFile` events? They do not have a FileId, which would be problematic, but they do not occur in the existing tests, so I marked them as `unreachable!()` so far.
2024-01-04 13:40:52 +00:00
Johann Hemmann
656ac104c9 Do not extract FileId for file_system_edits 2024-01-04 14:29:41 +01:00
Johann Hemmann
ea675ab888 Insert newline at the end 2024-01-04 14:01:03 +01:00
Johann Hemmann
f2b872a3c5 Switch to Vec, because we do want to have duplicate keys 2024-01-04 14:01:03 +01:00
Johann Hemmann
dea149d733 Switch to BTreeMap for stable ordering 2024-01-04 14:01:03 +01:00
Johann Hemmann
05a3c2ff20 Make filtering a function 2024-01-04 14:01:03 +01:00
Johann Hemmann
d1f4171bb6 Refactor to iterators 2024-01-04 14:01:03 +01:00
Johann Hemmann
084acc287a Extract relevant information into hashmaps 2024-01-04 14:01:02 +01:00
bors
c3a00b5468 Auto merge of #16251 - lnicola:span-description, r=lnicola
Add description to span crate manifest

CC https://github.com/rust-lang/rust-analyzer/actions/runs/7408827766/job/20157836624
2024-01-04 11:28:11 +00:00
Laurențiu Nicola
688911757e Add description to span crate manifest 2024-01-04 13:27:32 +02:00
bors
95e047e4ac Auto merge of #16248 - Veykril:proc-macro-test, r=lnicola
internal: Add proc-macro-test crate back to the main workspace

Should fix https://github.com/rust-lang/rust-analyzer/issues/16194
2024-01-04 11:00:33 +00:00
bors
8356bc9008 Auto merge of #16249 - lnicola:sync-from-rust, r=lnicola
internal: Sync from rust
2024-01-04 10:47:48 +00:00
Laurențiu Nicola
a66777cc71 Merge branch 'master' into sync-from-rust 2024-01-04 12:44:34 +02:00
Laurențiu Nicola
adf052c2ba Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-rust 2024-01-04 12:44:20 +02:00
Lukas Wirth
751d9d11e0 Add proc-macro-test crate back to the main workspace 2024-01-04 11:09:45 +01:00
Nilstrieb
f0f74486bf Give a userful error when rustc cannot be found in explicit sysroot
Somehow r-a believed that my sysroot was something weird with no rustc.
Probably a me issue, but it was impossible to diagnose since r-a just
gave me a plain "No such file or directory". Adding this error makes it
clear what happened and allows diagnosing the problem.
2024-01-03 21:01:06 +01:00
bors
9279c6566b Auto merge of #16237 - Veykril:expand-arc-alloc, r=Veykril
internal: Remove unnecessary `Arc` allocations in `macro_expand`
2024-01-03 14:40:10 +00:00
bors
c3c07c66d3 Auto merge of #15933 - 71:inherent-items-in-docs, r=Veykril
feat: resolve inherent and implemented associated items in docs

This partially fixes #9694.

Supported:
- Trait methods and constants.
  * Due to resolution differences pointed out during the review of the PR, trait associated types are _not_ supported.
- Inherent methods, constants and associated types.
  * Inherent associated types are a [nightly feature](https://github.com/rust-lang/rust/issues/8995), and are supported with no additional work in this PR.

Screenshot of VS Code running with the change:

<img width="513" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/7189784/c37ed8b7-b572-4684-8e81-2a817b0027c4">

You can see that the items are resolved (excl. trait associated types) since they are semantically highlighted in the doc comment.
2024-01-03 14:28:38 +00:00
Lukas Wirth
3fc043ce9b internal: Remove unnecessary Arc allocations in macro_expand 2024-01-03 15:21:18 +01:00
bors
3fe6ff74cf Auto merge of #16085 - Austaras:master, r=Veykril
fix: try obligation of `IndexMut` when infer

Closes #15842.

This issue arises because `K` is ambiguous if only inferred from `Index` trait, but is unique if inferred from `IndexMut`, but r-a doesn't use this info.
2024-01-03 14:18:13 +00:00
bors
4f94ebb45a Auto merge of #16238 - lnicola:gentoo-docs, r=lnicola
Tweak Gentoo instructions

CC https://github.com/rust-lang/rust-analyzer/pull/15922#discussion_r1398224723
2024-01-03 14:06:47 +00:00
Young-Flash
c5c1360f7b fix: make diagnostic range accommodate for macros 2024-01-03 22:05:30 +08:00
Laurențiu Nicola
570ee51d50 Tweak Gentoo instructions 2024-01-03 16:05:00 +02:00