Skip to content

feat: Add toggle to disable cache priming #10810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ config_data! {
/// Whether to allow import insertion to merge new imports into single path glob imports like `use std::fmt::*;`.
assist_allowMergingIntoGlobImports: bool = "true",

/// Warm up caches on project load.
cache_warmup: bool = "true",

/// Show function name and docs in parameter hints.
callInfo_full: bool = "true",

Expand Down Expand Up @@ -545,6 +548,10 @@ impl Config {
)
}

pub fn prefill_caches(&self) -> bool {
self.data.cache_warmup
}

pub fn location_link(&self) -> bool {
try_or!(self.caps.text_document.as_ref()?.definition?.link_support?, false)
}
Expand Down
4 changes: 3 additions & 1 deletion crates/rust-analyzer/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ impl GlobalState {
for flycheck in &self.flycheck {
flycheck.update();
}
self.prime_caches_queue.request_op();
if self.config.prefill_caches() {
self.prime_caches_queue.request_op();
}
}

if !was_quiescent || state_changed {
Expand Down
5 changes: 5 additions & 0 deletions docs/user/generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ Group inserted imports by the https://rust-analyzer.github.io/manual.html#auto-i
--
Whether to allow import insertion to merge new imports into single path glob imports like `use std::fmt::*;`.
--
[[rust-analyzer.cache.warmup]]rust-analyzer.cache.warmup (default: `true`)::
+
--
Warm up caches on project load.
--
[[rust-analyzer.callInfo.full]]rust-analyzer.callInfo.full (default: `true`)::
+
--
Expand Down
5 changes: 5 additions & 0 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@
"default": true,
"type": "boolean"
},
"rust-analyzer.cache.warmup": {
"markdownDescription": "Warm up caches on project load.",
"default": true,
"type": "boolean"
},
"rust-analyzer.callInfo.full": {
"markdownDescription": "Show function name and docs in parameter hints.",
"default": true,
Expand Down