This is in src/main.rs
src/http/query_string.rs
No hint
Note: This problem is resolved once query_string is imported to main.rs. Why doesn't rust-analyser read files within the src folder?
This is in src/main.rs
src/http/query_string.rs
No hint
Note: This problem is resolved once query_string is imported to main.rs. Why doesn't rust-analyser read files within the src folder?
You don't say what tooling you're using, but, assuming you're in VS Code with the rust-analyzer extension, what you're describing is as expected. Rust-analyzer works over projects, not directories, where a 'project' is typically a Cargo project (though you can configure it to use other build systems).
To be included in a Cargo project a rust file needs to follow the Cargo conventions or be explicitly brought into the module tree with mod
. Random rust files in the same dirs are not (as far as I understand) part of the project, so are not analysed by the language server (which is what provides completions to the editor).
It was VSCode
Thank you! This works. Now I need to research deeper into the Cargo conventions.
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.