Rust-analyzer extension keeps displaying (unlinked-file) in vsode

I'm new to rust, and trying making a small app for practicing, but every time i create a new module with file unme.rs, and refer to it with mod unme in root, while vscode and rust-analyzer in rustup are fine, RA extension keep displaying file not included in module tree rust-analyzer (unlinked-file) and blocking another work like code hinting.


It drives me nut, i try all i can think, do dry build with Cargo, change to old file path style..etc, it's still yelling at me. And even more strange, somehow the extension depicts both uppercase and snake case in file name, lead to it forces to have both name its root file, in my case is it needs to see mod unme and mod Unme in main.rs,
I don't know me or something happend with RA extentsion, either, but i kinda stress. Maybe put everything in main.rs root is recommended ?!

oh and for the second part here it is

The name in mod should be lowercase, same as the file name. There should be no reason to capitalize it. Remove the other mod Unme.

Also, make sure you save the file main.rs after adding mod unme; so that it takes effect.

Once you've done those, what do you see?

Hi, yes, normal way it should like you said, but problem is RA extension, it doesn't recognize module name and blocking that module from vscode, like i say above, if i delete the uppercase one then extension can't see that module, tho Cargo can still build and run fine, and therefore issue the unlinked-file and that file complete treats as text file in vscode, let alone main.rs

Did you previously create the file with a capitalized file name, Unme.rs? I'm thinking this might be a case-insensitive file system issue.

Have you tried restarting VS Code?

1 Like

nope, i'm following convention in rust book, and create everything normal, but it still issues, and i even try restart vscode, delete whole folder and run Cargo new but extension still yells at me

btw i moves to sublime text now, and everything works seamlessly fine, just change IDE i guess. Tbh if someone get into situation like me, just ditch vscode

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.