-
Notifications
You must be signed in to change notification settings - Fork 1.8k
VS Code: Renaming module from UpperCamelCase to snake_case leads to module being incorrectly reported as unlinked and unresolved #18273
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
Comments
Two seconds after creating the issue I opened VS Code again and now the module where I originally noticed this works properly again. I can't say for sure why it fixed itself in this instance. I only know that I tested the reproduction steps twice and tried reproducing the bug on a temporary module in the original project (the directory for which I deleted before open VSC again) |
I cannot reproduce this. In such cases it is useful to run |
Can it just be that you have your |
Is there anything I could provide that would help with reproducing it?
After starting VSC today the bug is back in the original project. Running
I checked, it is enabled. (In general, I didn't change the default settings) |
This is #9947, a vscode bug, it caches the casing on case insensitive file system, reporting wrong paths to the language server. You'll need to find the VSCode cache for your workspace and clear that |
rust-analyzer version:
rust-analyzer version: 0.3.2137-standalone (2b750da1a 2024-10-06) [c:\Users\<redacted>\.vscode\extensions\rust-lang.rust-analyzer-0.3.2137-win32-x64\server\rust-analyzer.exe]
rustc version:
rustc 1.81.0 (eeb90cda1 2024-09-04)
editor or extension: VS Code Rust-Analyzer v0.3.2137
relevant settings: Not sure what qualifies here and the given examples (
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
) all don't seem to be set (echo %CARGO%
etc. outputs%CARGO%
)steps to reproduce:
cargo new Test123
)code .
)src
directory create a new directory with a captial first letter (e.g.Asd
) andmod.rs
main.rs
addpub mod Asd;
asd
)Asd
directory wasn't always renamed during my tests - if it wasn't rename it toasd
by handmain.rs
changepub mod Asd;
topub mod asd;
VS Code will now display an error from the rust-analyzer:
unresolved module, can't find module file: asd.rs, or asd/mod.rs rust-analyzer[E0583](https://doc.rust-lang.org/stable/error_codes/E0583.html)
(sometimes you need to modify the file for this to show up)Further autocompletion will not work and if you add any code to the
mod.rs
(e.g.fn test() {}
) it will be grayed out with the message:I have tried:
The only way of fixing this seems to be having
pub mod Asd;
inmain.rs
.I have not managed to get a module name out of this weird state, here is what I tried:
target
directoryother notes:
I found this on the forum, however it is closed and the person just stopped using VSC which isn't really a solution imo, but hey works for them ig)
I don't think there is an issue for this yet, however I have to be honest I don't know how people find anything in the github issues search.
It might be related in some way to #9173, since E0583 shows up there too and also compiles without a problem in both cases.
This does not affect other modules in the project they work just fine, however can also be brought into that state at the same time.
Hope this helps!
The text was updated successfully, but these errors were encountered: