I'm using rust-analyzer in VSCode in a rust workplace (version 0.3.2379
: rust-lang.rust-analyzer-0.3.2379-darwin-arm64).
I have auto-update set, and this version seems to be the latest one that was just released yesterday or so. But I noticed today that even though I don't get errors or warnings, analyzer annotations on the types and functions of a dependency are no longer working. In the workplace there are two library crates (haitaka
and haitaka-types
), the top one (haitaka
) has a dependency on the other one. The main types and functions of the haitaka-types
crate are all exported again in the haitaka
lib.rs file. Cargo check, build, test, etc all runs fine. The only problem is just with rust-analyzer, while editing files in the top crate (the analyzer works fine when I'm in a file of haitaka-types
). Has anyone seen sth similar? I'm not aware I made any other changes myself that could have caused this behavior.
Did you open vscode from the directory containing your Cargo.toml
? If not, try that.
I'm sorry, I don't know how to interpret that answer. VSCode doesn't know about the directory I'm in when I'm also running a bash shell -- it's not opened "from a directory". It's just opened as app globally. Or did you mean something else? Anyway, I verified that it indeed doesn't matter which directory I'm in when I start up VSCode - the new, unexpected behavior still continued.
I found a solution. In my VSCode user settings.json I removed all previous rust-analyzer settings. I also uninstalled and re-installed the rust-analyzer extension. Annotations are now again being generated as expected.