rust - analyzer fails to recognize snake case sub - module file #20099
Unanswered
Underline-1024
asked this question in
Q&A
Replies: 1 comment
-
Are you on Windows and was the file originally named |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered an issue where rust - analyzer is unable to recognize a file as part of the module tree when using snake case for the module name.
I defined a module in src/network.rs:
pub mod stream;
Then I created the file at src/network/stream.rs.
But when I started writing code in stream.rs, rust - analyzer displayed the message:
This file is not included anywhere in the module tree, so rust - analyzer can't offer IDE services.
If you're intentionally working on unowned files, you can silence this warning by adding "unlinked-file" to rust-analyzer.diagnostics.disabled in your settings.
Following rust - analyzer's suggestion to change pub mod stream; to pub mod Stream; resolved the issue, but then I received a warning that the module name isn't in snake case.
According to Rust's conventional naming, modules should use snake case. Shouldn't rust - analyzer recognize the file as part of the module tree when using snake case for the module name? Is there a way to make it work without having to disable the "unlinked-file" warning or changing the module name to Pascal case? Could this be a bug in rust - analyzer's module resolution logic?
Here are the versions I'm using:
Rust - analyzer version: v0.3.2319
rustc version: 1.85.0
I would appreciate any insights or solutions to this problem. Let me know if you need any more information.
Beta Was this translation helpful? Give feedback.
All reactions