Analysis of macro embedding code

I'm using VSCode with rust-analyzer plugin and I see that code contained in macros (such as cfg_if macro which I use for conditional compilation) is not analyzed the same way as normal Rust code. Rust-analyzer does raise compilation errors (which makes sense) however many analysis features do not seem to work for the code embedded in macros:
- auto-indent
- type help
- auto-completion
- ...
I did some research about that issue and I did not find any solution. Thus I'm wondering whether there is something to enable so that code embedded in macro gets analyzed the same way as other code ?

RA already tries its best to improve the experience of coding with macro. At least for me, it's magical to see the auto-completion and hovering doc support in macros:


It must need a lot of hard work to let macros work like normal items in Rust.

Yes that is true, I imagine dealing with macro is a challenging task ! Thanks a lot for your reply as it allowed me to realize that my setup was probably missing something ... I installed the pre-release version of RA and now it works like a charm !

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.