Analyze crate not in workspace

I have big bilingual project with many subdirectories. In the root directory I have Cargo.toml, that describes cargo workspace. Half of subdirectories are rust crates and added to the workspace as members. Several subdirectories are also rust crates, but not members of root workspace.

I use VS Code + rust-analyzer. When I open root dir in vscode, it runs rust-analyzer on all members of cargo workspace, but does nothing to subdirectories, which are not members of workspace. Autocompletion, suggestions, navigation - everything doesn't work in those subdirectories.

Can I configure rust-analyzer to analyze not only cargo workspace's members, but also list of several subdirectories (which are not members of the workspace)? Which setting I must tune up?

Have you tried setting rust-analyzer.linkedProjects to an array of paths to your Cargo.toml files? User Manual

1 Like

The rust-analyzer.linkedProject setting is an array to Cargo.toml files. You can add the Cargo.toml of each cargo workspace and each crate not part of a cargo workspace. Make sure to also add the root ./Cargo.toml.

1 Like

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.