Open vsiles opened 1 month ago
This is weird, and I don't know what could cause this.
However, the thing to try first is to set plugins.lsp.servers.rust-analyzer.installCargo
and plugins.lsp.servers.rust-analyzer.installRustc
to false
.
Like so, the LSP will fall back to using the cargo/rustc from your environment.
Looks like it works ! In my config I'm using rustaceanvim instead of configuring rust-analyzer all by myself. Doing what you wrote made the error disappear, but I now have two RA running with the message:
nvim-lspconfig.rust_analyzer has been setup.
This will likely lead to conflicts with the rustaceanvim LSP client.
See ':h rustaceanvim.mason'
I tried to change my config in this way:
rustaceanvim = {
enable = true;
settings = {
server = {
default_settings = {
rust-analyzer = {
installCargo = false;
installRustc = false;
cargo = {
allFeatures = true;
};
check = {
command = "clippy";
};
inlayHints = {
lifetimeElisionHints = {
enable = "always";
};
};
};
};
standalone = false;
};
};
};
but it didn't work. I'll continue to see how I can avoid that warning message ;)
Feels like I have to enable rust-analyzer
(https://github.com/nix-community/nixvim/blob/main/plugins/lsp/language-servers/rust-analyzer.nix#L40) for the installCargo/Rustc
option to be taken into account.
Do you think there's a way around that without pulling the checks out of the lib.mkIf
?
@GaetanLepage do you know of a way to configure installCargo
and installRustc
to false while using rustaceanvim
and not rust-analyzer directly ?
rustaceanvim
(unsure)unstable
unstable | <!-- [OPTIONAL]
unstable` or specific version -->Description
I have a strange behavior where rust-analyzer no longer shows diagnostics in nvim. I identified one occurrence (and can't explain why :D) but it's not the only one. nvim is install via home-manager/nixvim (https://github.com/vsiles/config/tree/master/home-manager)
Here's a repro:
If I run
rust-analyzer diagnostics .
in the console, orcargo check
, I do get the error. But with that simple build.rs, I don't have them in the editor.I have other projects where I can't pinpoint what is bothering RA. How can I debug this ? I tried to set
RA_LOG=info
ordebug
but I don't see anything relevant. Any suggestions ?For completeness:
nix run nixpkgs#neovim -- -u minimal.lua
and I see the error with or without the build fileThis is why I think something's amiss in the way nixvim wraps nvim.
Minimal, Reproducible Example (MRE)