Stream: t-compiler/wg-rls-2.0

Topic: proc macro support


David Yamnitsky (Jul 07 2020 at 19:48, on Zulip):

Is there an issue that tracks support for procedural macros in rust-analyzer? I did not find one after a search on GitHub. I recently implemented a proc macro for JSX-like syntax: let html = html!(<div>{text}</div>);. If rust-analyzer executed the procedural macro like rustc does, it could theoretically support features like "go to definition" and "find references" when the cursor is over the identifier text.

bjorn3 (Jul 07 2020 at 20:38, on Zulip):

You need to enable rust-analyzer.loadOutDir and rust-analyzer.proc_macro in the preferences. (not sure about the exact naming, but autocomplete should show them when editing the json preferences in vscode.

bjorn3 (Jul 07 2020 at 20:39, on Zulip):

@nitsky ^

Florian Diebold (Jul 07 2020 at 20:39, on Zulip):

we don't support function-style proc macros yet though, only derives

Florian Diebold (Jul 07 2020 at 20:40, on Zulip):

... do we? :thinking:

matklad (Jul 07 2020 at 20:44, on Zulip):

Yup, we don't support fun-style proc macros yet

nitsky (Jul 08 2020 at 14:56, on Zulip):

thanks, I opened an issue: https://github.com/rust-analyzer/rust-analyzer/issues/5265

Last update: Sep 27 2020 at 13:00UTC