nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

[BUG] rust-analyzer stops providing diagnostics without clear reason

Open vsiles opened this issue 6 months ago • 4 comments

Field Description
Plugin rustaceanvim (unsure)
Nixpkgs unstable
Home Manager `unstable

  • [ x ] I have read the FAQ and my bug is not listed there.

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:

$ cargo new test-project
$ cd test-project
$ cargo add whoami
$ nvim src/main.rs # add a line `const X : bool = 42;`, it should show an error
$ echo "fn main() { let _ = whoami::username(); }" > build.rs
$ nvim src/main.rs # no more error !
$ # download https://github.com/mrcjkb/rustaceanvim/blob/master/troubleshooting/minimal.lua
$ nvim -u minimal.lua src/main.rs # no error either

If I run rust-analyzer diagnostics . in the console, or cargo 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 or debug but I don't see anything relevant. Any suggestions ?

For completeness:

  • I tried opening the file with helix to make sure it was something to do with the editor, not rust-analyzer, and I see the error with or without the build file
  • I tried opening the file with nix run nixpkgs#neovim -- -u minimal.lua and I see the error with or without the build file

This is why I think something's amiss in the way nixvim wraps nvim.

Minimal, Reproducible Example (MRE)

$ cargo new test-project
$ cd test-project
$ cargo add whoami
$ nvim src/main.rs # add a line `const X : bool = 42;`, it should show an error
$ echo "fn main() { let _ = whoami::username(); }" > build.rs
$ nvim src/main.rs # no more error !
$ # download https://github.com/mrcjkb/rustaceanvim/blob/master/troubleshooting/minimal.lua
$ nvim -u minimal.lua src/main.rs # no error either

vsiles avatar Jul 31 '24 16:07 vsiles