rust-lang / rust-lang/rust-analyzer

"Go To Definition" on a macro-generated type should go to the macro output, not its invocation

Open
#18,958 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Currently, "go to definition" on a type that was generated by a macro takes you to the macro invocation. This is extremely inconvenient for complicated macros that generate a lot of code. It would be far more convenient if it took you to the expansion of the macro instead.

rust-analyzer is already capable of showing the macro expansion with the "expand macro recursively" command, and it knows which specific macro invocation a definition comes from, so it should already have all the information needed to take you there directly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing “Go To Definition” behavior for macro-generated types and compare it with the existing “expand macro recursively” command. The work is done when navigation targets the relevant macro expansion rather than the invocation, including complicated macros.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.