How to make VS code show overlay hint of macro code

1

Normally, I can see the method list as an overlay like this.





But when modifying macro codes, overlay does not work.

How could I make VS code show them?

I hope I'm wrong about this, but I don't believe you can. When you have code inside a macro, that code could mean anything, so the language server doesn't know what to do.

1 Like

You are somewhat wrong about it :slight_smile: rust-analyzer does understand what a token in a macro input maps to in the expansion of a macro, the problem though comes from incomplete inputs to macros. Assuming the macro in question is a declarative macro (macro_rules), r-a might be taking the wrong macro arm (this is something we still need to improve upon). Otherwise, assuming this is a proc-macro r-a might be failing to fixup the syntax to something valid (as otherwise proc-macros will just error out without expanding to anything). Completions will most likely start to work if you write the first character of the field access / method call in that position as that fixes the current syntax error.

3 Likes

here is a proc-macro question, and it may be helpful: How to please ra for a better attribute macro experience? · rust-lang/rust-analyzer · Discussion #15570 (github.com)

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.