Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SludgePhD opened this issue Jan 17, 2025 · 2 comments
Labels
A-ide general IDE features C-feature Category: feature request

Comments

@SludgePhD
Copy link

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.

@SludgePhD SludgePhD added the C-feature Category: feature request label Jan 17, 2025
@lnicola lnicola added the A-ide general IDE features label Jan 17, 2025
@flodiebold
Copy link
Member

The macro expansion isn't really a location we can go to, so I'm not sure how possible this is. There are some related/alternative ideas in #7890.

@Veykril
Copy link
Member

Veykril commented Jan 17, 2025

We could probably make it work with an lsp extension to allow the server to allocate "fake files" on the client side. Anything but trivial though for a variety of reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ide general IDE features C-feature Category: feature request
Projects
None yet
Development

No branches or pull requests

4 participants