I recently configured neovim (using the builtin LSP client) to work with rust-analyzer and my code has a lot of warnings like "proc macro x not expanded". I noticed there is a setting to enable or disable this but I can't seem to get it to work and was wondering if anyone else has?
My configuration is here. I haven't used lua before but the lua bits were taken from github snippets and articles.
I'm not sure whether these settings are actually being sent to rust-analyzer at all. My next step will to be to try to get some log output from the process and see what I can find there. Then I'll probably give up and rebuild it with hard-coded values which will probably be much easier than fiddling about with lua .
Usually I can figure these things out but here I'm admitting defeat. Between the "... it’s up to the editor to decide on the exact format and location of configuration files.", the manual section on Emacs, notes on Spacemacs' lsp layer, and lsp-mode's own documentation, it's not clear to me where or how to set those values given above. If anyone has been successful at this, please let us know.
Square brackets round the "unresolved-proc-macro" didn't work, but they can either be left out or braces used instead, which seems to be a lua array.
I should have read the documentation on the website. I did read it on github but that is missing some generated parts, which is why I found procMacro (which doesn't seem to affect this either way.) but not the diagnostic name. Edit: Enabling procMacro does solve this problem - I probably had a typo somewhere.
I'll look at opening a PR to try to make some of this clearer.
For Emacs, lsp-mode defines customization variables for most of these options (if there's one missing, feel free to report an issue or add it yourself). So for example, to turn on proc macros you need to do (setq lsp-rust-analyzer-proc-macro-enable t) (and probably also (setq lsp-rust-analyzer-cargo-load-out-dirs-from-check t)). You can also use the customize-group command with the lsp-rust group to see all the rust-analyzer options.
Please check whether those errors still occur in the newest nightly, and if so, report an issue. You can disable those errors as well though by adding "macro-error" to the disabled diagnostics.