rust-lang / rust-lang/rust-analyzer
[Feature Request] Go to Definition from the comments
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
In clangd we have some simple heuristics to provide Go to Definition for symbols mentioned in the comments. If there are structs/functions/<...> with he same name around the comment, we allow jumping to that symbol right from the comment. I find it really useful and it helps navigate the code faster, so it would be really nice to have something like this in rust-analyzer.
Ideally, this could be even more advanced than what we have in clangd since Rust does have a rich comment format that can actually reference symbols and provide better documentation. I've tried pressing gd on some of the type names in Rust Standard Library and in toy examples like the one I have below for clangd but nothing happened.
https://user-images.githubusercontent.com/3352968/140510608-bec099f1-7657-46eb-8109-c75e8a77454e.mov
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 reproducing the reported behavior in rust-analyzer with the Rust Standard Library and the linked toy example or video. Define which symbols in comments should support Go to Definition, then verify that the selected references navigate correctly and that Rust's richer comment references are handled as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100