-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Autocompletion for newly added crate doesn't work after cargo add
it, but works after editing Cargo.toml directly
#15554
Comments
Hello, I can reproduce the issue while using a clean lazyvim installation, apparently it doesn't reload the work space, because if i manually type |
Could also be related to the client-side watching implementation. Although TBH I remember occasionally having issues in Code too. |
I don't use VSCode, so there are only some basic extensions. I tried again today in VSCode, autocompletion still won't work after only
Oh, it's true. Because even though I don't run It's just weird that RA already noticed the newly added crate without any import error, but didn't provide completion information. |
I have the same issue on both my desktop and laptop. They share the same info on the following aspects. Windows version:
VSCode version:
rust-analyzer version: I did a clean install of VSCode on my laptop, so the settings are the default ones. I only installed the rust-analyzer extension to do the test. I’ve tried both the user and system installer of VSCode, but the result is the same. Cargo remove also has the same problem. |
Reproduced:
With rust-analyzer extention Something maybe useful:
|
This is most likely a problem with VSCode's file watcher implementation, you can work around this by telling rust-analyzer to do server side filewatching instead via |
Thanks for explaining. Till now, I've tested these
So I'm closing this. |
This might be a real RA bug. But Code does send some funny notifications:
So we never see a |
Interesting notification indeed but not necessarily wrong. I wonder if we get confused by invalidating a path multiple times in a loop |
Hmm, I do see a bug here that could cause this, though im confused that |
Hmm, actually why is VSCode sending us events for the files being created and modified instead of just created? That seems weird (not that it matters to us here) |
|
OOOOOH now I also see why r-a doesn't realize that a new file was created for a module via the diagnostic quickfix if it was created by vscode. It probably sends us multiple notifications for the file which causes us to enter a created entry in the VFS, and then the following invalidation re-sets the entry causing us to switch from created to modified since it already exists in the VFS ... I've been bothered by that for ages 😄 |
rust-analyzer version: 0.3.1641-standalone (144526c 2023-08-28)
rustc version: rustc 1.73.0-nightly (e4c144684 2023-08-04)
relevant settings: no
Autocompletion for newly added crate doesn't work after
cargo add
it, but works after editing Cargo.toml directly.The problem is found in https://users.rust-lang.org/t/nvim-rust-analyzer-fails-to-provide-autocomplete-for-new-crates/99329
The text was updated successfully, but these errors were encountered: