rust-lang / rust-lang/rust-analyzer
Go to Definition on Private Symbols
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
It's a not wholly uncommon occurrence for me to import or otherwise use something that's private within my own code and it always feels clunky to have to manually go to the symbol because Go To Definition doesn't work on private symbols.
Here's a minimum example:
fn main() {
public_module::accidentally_private;
}
pub mod public_module {
fn accidentally_private() {}
}
If you try to use Go to Definition on public_module::accidentally_private you're unable to, despite the fact that rustc itself points out the line number. It's not a huge deal, it'd just be nice to have as an improvement.
I'd be willing to submit a PR for this but I'd appreciate first knowing if this is a tenable idea as well as a rough direction, e.g. where Go to Definition happens and possibly how to look up private symbols if that's tricky.
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
Start by tracing the Go to Definition entry point in rust-analyzer and reproduce the private-symbol example from the issue. Determine how the declaration is resolved when rustc reports a visibility error, then add a regression test showing that Go to Definition reaches the private function declaration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100