-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-macromacro expansionmacro expansionC-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )Big architectural things which we need to figure up-front (or suggestions for rewrites :0) )S-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
Inspired by this forum post...
It'd be nice to provide some navigation features in macro definitions / expansions. E.g. if you navigate to the definition of println
, you get
macro_rules! println {
() => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::io::_print($crate::format_args_nl!($($arg)*));
})
}
and can't click on _print
, for example.
Here are various ideas, in order of how hard I expect them to be:
- we could add a heuristic to detect $crate paths and allow navigating to them in macro definitions.
- our "expand macro" functionality could be improved to show expansions inline and allow you to use navigation features in the expanded code. There's already Refactor and improve macro debugging/general utilities #5949 about this, though I think it'd be cool to overlay the expansion inline.
- it might even be possible to keep some context when using "go to definition" on a macro call, which would allow us to interpret the macro definition in the context of the original call. I think IntelliJ does something similar with type parameters already, and I seem to remember talking about this with @matklad before, but I didn't find an existing issue about this.
edwin0cheng, Mingun, demosdemon, dani-garcia and bbb651
Metadata
Metadata
Assignees
Labels
A-macromacro expansionmacro expansionC-ArchitectureBig architectural things which we need to figure up-front (or suggestions for rewrites :0) )Big architectural things which we need to figure up-front (or suggestions for rewrites :0) )S-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now