Open krkhan opened 3 years ago
rust-analyzer.cargo.allFeatures
would be the correct setting for this. Are you sure this is the right way to set settings in nvim-lsp? You could e.g. try setting rust-analyzer.diagostics.enable
to false
just to see if it's working; if the settings are sent correctly then that should hide the diagnostics completely.
The syntax looks fine to me, I have:
nvim_lsp.rust_analyzer.setup({
on_attach=on_attach,
settings = {
["rust-analyzer"] = {
assist = {
importMergeBehavior = "last",
importPrefix = "by_self",
},
cargo = {
loadOutDirsFromCheck = true
},
procMacro = {
enable = true
},
}
}
})
I get the same thing in Code:
Setting rust-analyzer.diagostics.enable
to false
indeed turns off the diagnostics. The syntax is correct but according to https://github.com/rust-analyzer/rust-analyzer/issues/3897#issuecomment-655317883 :
rust-analyzer.checkOnSave.allFeatures
was disabled in #4711 because a lot of people were working on projects with incompatible features (e.g. game engine backends) or that had a nightly feature. See also the discussion in #4704.
rust-analyzer.cargo.allFeatures
was disabled in the same PR to keep things consistent, although it's less bad to have it always enabled.
The recommendation seemed to be to use rust-analyzer.checkOnSave.extraArgs
but that is not helping either.
No, no, it should work. rust-analyzer.cargo.allFeatures
is disabled by default, but you can enable it, and rust-analyzer.checkOnSave.allFeatures
is unset and unless you change it, has the same value as rust-analyzer.cargo.allFeatures
.
rust-analyzer.cargo.allFeatures
controls our analysis of the code (which includes those "inactive due to #[cfg]
" diagnostics) and rust-analyzer.checkOnSave.allFeatures
is used when we run cargo check
during save. You want the first one, but it might have stopped working.
@krkhan can you check whether your with_ctap1
feature is declared in Cargo.toml
? I'm only able to reproduce this when it's not.
@lnicola Yes it does seem to be: https://github.com/google/OpenSK/blob/stable/Cargo.toml#L29
This was bugging me as well. Code behind
#[cfg(...)]
#[test]
wasn't regocnized at all with the default settings. Finally this worked for me:
nvim_lsp.rust_analyzer.setup({
capabilities=capabilities,
on_attach=on_attach,
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
},
})
Tried the suggestions in #3897 as well but no matter what I try I cannot get rust-analyzer to activate all features.
Currently at commit aa38fa1