Closed tigercat2000 closed 2 years ago
I can't reproduce either of those bugs locally, sadly
I also can't reproduce my own bug. It now just works.
I tried to restart VScode completely, reload rust-analyzer, delete the file contents, rename the file, and none of it worked before... and now it just works.
Weird.
Will close the issue then since we have no hints on what caused this, if it re-appears feel free to reopen it.
I just had this happened to me right now.
If I rename the file it then works. I assume it has to do with the file name being duplicated somehow... (as there's also another cache.rs file somewhere else)
Happy to share you more about it, it is an open source. Here's the current file structure, frozen for you to try out: https://github.com/ConsoleTVs/Valar/tree/36a4704a48559594ae2574f75483d68755004cf8
Let me know if you need anything else, cheers!
Keeps happening to me too... I noticed its most often when I create a new file and copy paste some code. Can't tell which part does that exactly, but either way very annoying.
EDIT : use "rust-analyzer.showUnlinkedFileNotification": false,
in your settings JSON to make this issue go byebye
Not only I get the notification after adding mod, the notification is always for the cargo.toml file for some reason, or cargo.lock not sure, one of the 2
Also keeps happening to me for some reason. whenever I open Cargo.toml. This didn't happen a few months ago.
Because there's an issue use this to fix it up until they fix it
I am not sure if that issue would fix the file not getting "analysed", therefore losing type information.
I'm being bombarded by the same file does not belong to
prompts, but my circumstances are different. First, there's an additional error right after starting VS Code:
[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/jammy/Workspace/notes/./Cargo.toml, Some(Version { major: 1, minor: 68, patch: 2 }): Failed to run `cd "/home/jammy/Workspace/notes" && "cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/jammy/Workspace/notes/./Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"`: `cargo metadata` exited with an error: error: manifest path `/home/jammy/Workspace/notes/./Cargo.toml` does not exist
The difference is, unlike posters above, I use multiple root folders in my workspace, and the notes
folder is just a bunch of .md
files. The only Rust code is in the hello
folder, and it's just an empty project courtesy of cargo. When I reorder the two folders in VS Code so that the hello
folder is first, all the errors vanish. When I reorder them back, they reappear. It looks to me that the VS Code extension just grabs the first root folder in the workspace and ignores the rest?
I use rust-analyzer v0.3.1481
with rustc 1.68.2
. The issue reproduces with all extensions other than rust-analyzer
disabled and VS Code restarted.
Can confirm that what @nngeorgiy noticed it true. There is an issue here, please reopen.
Make sure to check your vscode workspace settings don't have any linkedProjects
settings configured. Other than that, please open a new issue ideally with a repo that reproduces this.
Since a few days I have this problem with some test code. VS Code (rust-analyzer
) constantly generates a .vscode/settings
file with following contents:
{
"rust-analyzer.showUnlinkedFileNotification": false
}
This is very annoying and I hope this will get fixed soon.
The testcode that constantly triggers this is the following: https://github.com/paritytech/wasmi/blob/rf-engine-regmach/crates/wasmi/src/engine/tests/regmach/op/call/indirect.rs
This is happening to me too, only for a file within a subfolder
btw.: I think this bug is connected to https://github.com/rust-lang/rust-analyzer/issues/15352.
I reproduce the bug in a project that has one Cargo.toml both for workspace and root package configuration.
Any fix?
I also facing the same problem. Why this issue is closed?
I am also running into this
rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command) rust-analyzer version: 5d5bbec9b 2022-05-08 nightly
rustc version: (eg. output of
rustc -V
) rustc 1.62.0-nightly (52ca603da 2022-04-12)relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTUP_HOME
orCARGO_HOME
) Unknown.In my project here: https://github.com/spacestation13/BYONDDiffBots
Rust Analyzer won't load
crates/mapdiffbot2/src/github_processor.rs
as part of themapdiffbot2
crate. Instead, it just reports "File info: Does not belong to any crate", as seen below.This doesn't happen with any other files in the repository.
crates/mapdiffbot2/src/rendering.rs
loads fine:Furthermore, on the
idb2
branch,crates/icondiffbot2/src/github_processor.rs
does not have the issue, whilecrates/mapdiffbot2/src/github_processor.rs
does, despite having the same file name, and being included with the samemod
statement in the respectivemain.rs
.Please let me know if there is any more information I can provide, I'm not familiar with how to debug rust-analyzer.