-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erroneous hints "proc macro Foo
not expanded"
#7497
Comments
Did you enable proc macro support? |
Is that some new requirement? I didn't change any settings when updating rust-analyzer and I didn't get these hints with earlier version. I'm using Sublime Text as editor. |
It's not a new requirement, but the hints are new. They're shown so that you know the macros weren't expanded, and why some features (e.g. completion) don't work with code using them. You can either enable proc macro support or disable the diagnostics. |
Why is the default to spam output with useless hints? Shouldn't it be better to opt-in to such hints instead of having to disable them for EVERY project? |
You don't have to disable them per project, just once in the LSP settings (if you want). And no, making the hints opt-in would make them useless, since someone who doesn't know that they need to enable a setting to have proc-macros be expanded is unlikely to know to enable a hint about it. This will go away when we enable proc macro expansion by default. |
ok, disabling it works, but I still think this is a mis-feature. For Sublime Text 3: Preferences > Package Settings > LSP > Settings
|
Just to be clear, you probably want to enable proc macro support, not disable the diagnostic, unless you have specific reasons not to. (And if you do have specific reasons, you might want to explicitly disable proc macros, since we'll enable them by default soon.) |
As far as I know hints are exactly for when a diagnostic would be too noisy to show as warning. Vscode only shows a gentle dotted line below the first character of the diagnostic range. It doesn't give any other indication of it's existence by default. |
But you can't just enable it, it requires some more settings also.
In Sublime Text 3 those are shown exactly as warnings or errors, just with "hint" instead of "warning" or "error", wasting space and spamming the output. |
Actually re-opening this as disabling does NOT work - I still get the hints. |
I'm going to guess you need to do |
Yes, it requires running |
Using "rust-analyzer.diagnostics.disabled" seems to work even though the "rust-analyzer" there is superfluous as it's already under "rust-analyzer" client. |
And even that isn't enough, it requires loading some OUT_DIRS which doesn't seem to be documented at all. How is that OUT_DIRS used? Is it a problem if it contains code for other projects also? etc. |
That's what I was referring to. You need to enable #6448 should provide more information about this. |
In my case (neovim with coc.nvim extension) adding
to |
Thanks, you saved my times. |
It took me ages to find this solution. It fixes a couple of issues I've been having with macros. Perhaps I'm crap at reading docs, but I feel this should have been more obvious. Not a criticism of anyone, just noting the issue. |
Just to add a little more to @Ch00k's solution for CoC. You can access the settings with
On my system, |
To conclude, this has been fixed now and should work out-of-the-box. coc-rust-analyzer might need updating separately, which you can do with |
After updating to rust-analyzer 2021-01-25 from 2-months old version, I started getting hints which looks erroneous:
#[derive(thiserror::Error)]
gives hint "proc macroError
not expanded"#[derive(Deserialize)]
gives hint "proc macroDeserialize
not expanded" (macro is fromserde
)The text was updated successfully, but these errors were encountered: