Open tjx666 opened 2 years ago
You can set "rust-analyzer.cache.warmup": false
to disable warming up of cache at startup.
@bjorn3 I tried it, but useless.
That is running the build scripts of all crates to get generated source files and compiling all proc macros. The results of this are cached by cargo, so you should only have to pay for it once if you don't change any build scripts or proc macros even if you restart rust-analyzer. If you want to disable this you can use set rust-analyzer.cargo.runBuildScripts
and rust-analyzer.procMacro.enable
to false. This may break things if dependencies of you depend on them though.
When I restart rust-analyzer, it will still load all crates again even if I didn't change anything. All the crates in my workspace doesn't depend each other. Why not rust-analyze analyzes the dependency relationship and load only the open folder and it's dependecies.
I do wish there was an option to disable indexing everything whenever I open a crate within a workspace. Right now, the only workaround I've found is to temporarily comment the workspace
line in the crate's Cargo.toml
, otherwise indexing time and memory usage are simply unbearable. But it's tedious to do it every time I switch projects.
@calops have you tried disabling rust-analyzer.cachePriming.enable
?
It is better with that setting (thanks for that), however it still builds all the proc macros of the other crates, and still cargo check
everything by default (although I can override that command, I feel like there should be a less hacky solution for this).
It also seems to not index the dependencies of my crate when I do this? If that's right, it's still not a suitable solution for me.
It is better with that setting (thanks for that), however it still builds all the proc macros of the other crates, and still
cargo check
everything by default (although I can override that command, I feel like there should be a less hacky solution for this).
IIUC Your requirement seems not related to the issue. You want cargo-check without --workspace, then just set check.workspace to false since https://github.com/rust-lang/rust-analyzer/pull/16510 .
Yeah that's fair, this new option solves my use-case.
In following workspace, there are may folders. Each folder is a crate. When I open this workspace, rust-analyzer will load all folders which heavily increae the timeout to get seamatic highlight and intellisence.
Why not just load the folder which user had open rust file in it?
For example, when I open the
main.rs
in folderenums
, just load the metadata of this crate.My workspace settings: