rust-analyzer: rust-analyzer.files.excludeDirs is (still) not working
rust-analyzer.files.excludeDirs does not appear to be working. Issue #7755 discussed this awhile ago and was closed, but the feature is still not working for me. I am using rust-analyzer 0.4.1501-standalone with rustc 1.68.2 in VSCode.
It could be that I misunderstand how to specify directories. My project layout is
.
├── src
├── module0
and my rust analyzer setting is
{
"rust-analyzer.files.excludeDirs: ["src/module0"]
}
I tried also setting files.watcherExclude, as suggested in the documentation, but no luck.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 17
- Comments: 20 (1 by maintainers)
I also have this problem. It would be nice if rust-analyzer can also just use entries from the
.gitignore.Does anyone have a good workaround for this? I’m using a Nix Flake to define my development environment, and although I have added
.direnvtoexcludeDirsrust analyzer continues to scan.direnv, and subsequently the entire nix store. It essentially never finishes.I was actually having this issue due to using
rustaceanvimplugin and it fixed itself when I switched to therust-analyzerlsp plugin instead. Here is my config for both rustaceanvim and nvim-lspconfig.rust_analyzer using nixvim.Enabling the
rustaceanvimplugin makes it also search the.direnvfolder even though it’s in theexcludeDirsThis is still an issue for me, but I am currently using a simple fix which I’m posting here in case it helps somebody else.
I couldn’t get
rust-analyzerto stop scanning the.direnvfolder, so in the end I placed my entire crate in a subfolder one level below theflake.nixfile and.direnvfolder. I did this using cranes guide to placing aCargo.tomlin a non-standard location.This has stopped the problem for me, as the
.direnvfolder is no longer in the workspace root. Not an ideal solution but at least something actionable.