rust-lang / rust-lang/rust-analyzer
"Find All References" doesn't work with "use X as Y" aliases
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.0.0 (b3b9b53df 2024-02-29)
rustc version: rustc 1.78.0-nightly (42825768b 2024-03-08)
relevant settings: N/A, although I interact with rust-analyzer through VSCode if that's relevant. The extension version I'm using is 0.3.1418.
repository link (if public, optional): N/A
code snippet to reproduce:
struct Foo;
use Foo as FooRenamed;
struct Bar(FooRenamed);
Expected behaviour when invoking Find All References on FooRenamed is that the usage in Bar shows up. The actual behaviour is that direct usages of "Foo" are searched for, which does not include the usage in Bar.
In fact, the reference in Bar can't be found at all using Find All References, as searching for usages of Foo doesn't reveal it either.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Rust snippet and begin at rust-analyzer’s Find All References request path, then trace how use Foo as FooRenamed is represented during reference lookup. Add a regression test for the alias and verify that Find All References on FooRenamed includes the usage in Bar.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100