Open techster10173 opened 2 months ago
For reference, the IDE that we use is VSCode
Setting rust-analyzer.linkedProjects
should help.
rust-analyzer.linkedProjects (default: []) Disable project auto-discovery in favor of explicitly specified set of projects. Elements must be paths pointing to Cargo.toml, rust-project.json, .rs files (which will be treated as standalone files) or JSON objects in rust-project.json format.
From our manual
Although, to answer your question completely, rust-analyzer looks for a Cargo.toml
and runs cargo metadata
on the path where the file is located, if your monorepo has a complicated dependency graph, there is nothing it can do but include all dependencies in its analysis. However, if crates are independent, then opening your editor not at the root of your monorepo, but at the root path of the crate should make your life easier.
You can turn off cache priming by setting rust-analyzer.cachePriming.enable
to false; this will skip the "indexing" step completely at the cost of making the first few requests take very long. You'll also probably want to turn off rust-analyzer.checkOnSave
.
In one of my projects, we operate off of a mono-repo which has multiple rust packages in it. As a result, rust-analyzer attempts to index the entire mono-repo causing the computer to reach very high levels of resource utilization. Would it be be possible to create a feature in which rust-analyzer, if it detects multiple
Cargo.toml
in leaves of the mono-repo directory, it only runs for the rust project that is currently opened in the IDE?Thanks!