Commit Graph

26939 Commits

Author SHA1 Message Date
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
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
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
Laurențiu Nicola
570ee51d50 Tweak Gentoo instructions 2024-01-03 16:05:00 +02:00
Grégoire Geis
fe6f931ac2 hir: resolve associated items in docs (excl. type aliases) 2024-01-03 23:04:24 +09:00
bors
91ffbd7788 Auto merge of #15922 - paul-jewell:master, r=Veykril
Updated instructions for installing rust-analyzer under Gentoo.

No need to install the guru overlay to install rust-analyzer. This is now installed based on use flag settings for dev-lang/rust and dev-lang/rust-bin. This pull request changes the instructions in the user manual.

Note: rust-analyzer is not available in the guru repository, so the old instructions no longer work.
2024-01-03 13:38:37 +00:00
bors
078183231b Auto merge of #16179 - nicolas-guichard:scip/new_fields, r=Veykril
SCIP: populate new SymbolInformation fields

Fixes #15919
2024-01-03 12:56:47 +00:00
bors
d987137b4e Auto merge of #16234 - Veykril:token-upmap, r=Veykril
fix: Fix focus range being discarded in attributes/derives when upmapping

Fixes https://github.com/rust-lang/rust-analyzer/issues/16229
2024-01-03 12:33:28 +00:00
Nicolas Guichard
73d9c77f2a scip: Populate SymbolInformation::kind
SymbolInformation::kind is finer-grained than the SCIP symbol suffix.
This also fixes a bug where all type aliases where treated like type
parameters.

```
trait SomeTrait {
  type AssociatedType; // ← this is SomeTrait#[AssociatedType]
}

type MyTypeAlias = u8; // ← this used to be [MyTypeAlias]
                       //   and now is MyTypeAlias#
```
2024-01-03 13:05:36 +01:00
Lukas Wirth
cf22f02dc5 fix: Fix focus range being discarded in attributes/derives when upmapping 2024-01-03 12:15:28 +01:00
Nicolas Guichard
566bb77f91 scip: Populate SymbolInformation::signature_documentation 2024-01-03 10:56:12 +01:00
Nicolas Guichard
b24914970f Refactor label & docs from ide::hover::render to ide-db::defs::Definition
To build the SymbolInformation::signature_documentation we need access
to the “label” when building the TokenStaticData, preferably without
any markdown markup.
Therefore this refactors ide::hover::render::definition and its helper
functions to give easier access to the label alone.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
495a55689b scip: Populate SymbolInformation::enclosing_symbol
For local variables, this gets the moniker from the enclosing
definition and stores it into the TokenStaticData.
Then it builds the scip symbol for that moniker when building the
SymbolInformation.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
62663e6d4b scip: Refactor token_to_symbol to moniker_to_symbol
This is meant to implement SymbolInformation::enclosing_symbol, so we
can build the enclosing symbol from the enclosing moniker without
having the full enclosing token's TokenStaticData.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
375f1cca4f scip: Populate SymbolInformation::display_name 2024-01-03 10:54:57 +01:00
Laurențiu Nicola
d3d7c4b722 Allow unexpected_cfgs in proc-macro-test imp 2024-01-03 11:36:05 +02:00
Laurențiu Nicola
932d85b529 Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-ra2 2024-01-03 11:35:07 +02:00