Add toggle to disable cache priming

This commit is contained in:
Laurențiu Nicola 2021-11-19 17:56:46 +02:00
parent cf2ddb935e
commit a68ce62f6a
4 changed files with 20 additions and 1 deletions

View file

@ -58,6 +58,9 @@ config_data! {
/// Whether to allow import insertion to merge new imports into single path glob imports like `use std::fmt::*;`. /// Whether to allow import insertion to merge new imports into single path glob imports like `use std::fmt::*;`.
assist_allowMergingIntoGlobImports: bool = "true", assist_allowMergingIntoGlobImports: bool = "true",
/// Warm up caches on project load.
cache_warmup: bool = "true",
/// Show function name and docs in parameter hints. /// Show function name and docs in parameter hints.
callInfo_full: bool = "true", callInfo_full: bool = "true",
@ -545,6 +548,10 @@ impl Config {
) )
} }
pub fn prefill_caches(&self) -> bool {
self.data.cache_warmup
}
pub fn location_link(&self) -> bool { pub fn location_link(&self) -> bool {
try_or!(self.caps.text_document.as_ref()?.definition?.link_support?, false) try_or!(self.caps.text_document.as_ref()?.definition?.link_support?, false)
} }

View file

@ -433,8 +433,10 @@ impl GlobalState {
for flycheck in &self.flycheck { for flycheck in &self.flycheck {
flycheck.update(); flycheck.update();
} }
if self.config.prefill_caches() {
self.prime_caches_queue.request_op(); self.prime_caches_queue.request_op();
} }
}
if !was_quiescent || state_changed { if !was_quiescent || state_changed {
// Refresh semantic tokens if the client supports it. // Refresh semantic tokens if the client supports it.

View file

@ -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::*;`. 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`):: [[rust-analyzer.callInfo.full]]rust-analyzer.callInfo.full (default: `true`)::
+ +
-- --

View file

@ -445,6 +445,11 @@
"default": true, "default": true,
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.cache.warmup": {
"markdownDescription": "Warm up caches on project load.",
"default": true,
"type": "boolean"
},
"rust-analyzer.callInfo.full": { "rust-analyzer.callInfo.full": {
"markdownDescription": "Show function name and docs in parameter hints.", "markdownDescription": "Show function name and docs in parameter hints.",
"default": true, "default": true,