Skip to content

Commit 7a55863

Browse files
committed
Auto merge of #12223 - Veykril:config-stuff, r=Veykril
internal: Rename primeCaches config keys
2 parents d121307 + 84176f6 commit 7a55863

File tree

5 files changed

+36
-34
lines changed

5 files changed

+36
-34
lines changed

crates/rust-analyzer/src/config.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ config_data! {
5757
/// Placeholder expression to use for missing expressions in assists.
5858
assist_expressionFillDefault: ExprFillDefaultDef = "\"todo\"",
5959

60+
/// Warm up caches on project load.
61+
cachePriming_enable: bool = "true",
62+
/// How many worker threads to to handle priming caches. The default `0` means to pick automatically.
63+
cachePriming_numThreads: ParallelCachePrimingNumThreads = "0",
64+
6065
/// Automatically refresh project info via `cargo metadata` on
6166
/// `Cargo.toml` or `.cargo/config.toml` changes.
6267
cargo_autoreload: bool = "true",
@@ -320,11 +325,6 @@ config_data! {
320325
/// Whether to show `can't find Cargo.toml` error message.
321326
notifications_cargoTomlNotFound: bool = "true",
322327

323-
/// Warm up caches on project load.
324-
primeCaches_enable: bool = "true",
325-
/// How many worker threads to to handle priming caches. The default `0` means to pick automatically.
326-
primeCaches_numThreads: ParallelPrimeCachesNumThreads = "0",
327-
328328
/// Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.
329329
procMacro_attributes_enable: bool = "true",
330330
/// Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.
@@ -402,7 +402,7 @@ pub struct Config {
402402
snippets: Vec<Snippet>,
403403
}
404404

405-
type ParallelPrimeCachesNumThreads = u8;
405+
type ParallelCachePrimingNumThreads = u8;
406406

407407
#[derive(Debug, Clone, Eq, PartialEq)]
408408
pub enum LinkedProject {
@@ -716,7 +716,7 @@ impl Config {
716716
}
717717

718718
pub fn prefill_caches(&self) -> bool {
719-
self.data.primeCaches_enable
719+
self.data.cachePriming_enable
720720
}
721721

722722
pub fn location_link(&self) -> bool {
@@ -1189,7 +1189,7 @@ impl Config {
11891189
}
11901190

11911191
pub fn prime_caches_num_threads(&self) -> u8 {
1192-
match self.data.primeCaches_numThreads {
1192+
match self.data.cachePriming_numThreads {
11931193
0 => num_cpus::get_physical().try_into().unwrap_or(u8::MAX),
11941194
n => n,
11951195
}
@@ -1661,7 +1661,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
16611661
"Search for all symbols kinds"
16621662
],
16631663
},
1664-
"ParallelPrimeCachesNumThreads" => set! {
1664+
"ParallelCachePrimingNumThreads" => set! {
16651665
"type": "number",
16661666
"minimum": 0,
16671667
"maximum": 255

crates/rust-analyzer/src/config/patch_old_style.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
3434
assist.importMergeBehaviour -> imports.granularity.group;
3535
assist.importGroup -> imports.group.enable;
3636
assist.importPrefix -> imports.prefix;
37-
cache.warmup -> primeCaches.enable;
37+
primeCaches.enable -> cachePriming.enable;
38+
cache.warmup -> cachePriming.enable;
3839
cargo.loadOutDirsFromCheck -> cargo.buildScripts.enable;
3940
cargo.runBuildScripts -> cargo.buildScripts.enable;
4041
cargo.runBuildScriptsCommand -> cargo.buildScripts.overrideCommand;
@@ -50,7 +51,7 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
5051
hover.linksInHover -> hover.links.enable;
5152
hoverActions.linksInHover -> hover.links.enable;
5253
hoverActions.debug -> hoverActions.debug.enable;
53-
hoverActions.enable -> hoverActions.enable.enable;
54+
hoverActions.enable -> hoverActions.enable;
5455
hoverActions.gotoTypeDef -> hoverActions.gotoTypeDef.enable;
5556
hoverActions.implementations -> hoverActions.implementations.enable;
5657
hoverActions.references -> hoverActions.references.enable;

docs/user/generated_config.adoc

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
--
44
Placeholder expression to use for missing expressions in assists.
55
--
6+
[[rust-analyzer.cachePriming.enable]]rust-analyzer.cachePriming.enable (default: `true`)::
7+
+
8+
--
9+
Warm up caches on project load.
10+
--
11+
[[rust-analyzer.cachePriming.numThreads]]rust-analyzer.cachePriming.numThreads (default: `0`)::
12+
+
13+
--
14+
How many worker threads to to handle priming caches. The default `0` means to pick automatically.
15+
--
616
[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`)::
717
+
818
--
@@ -477,16 +487,6 @@ Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
477487
--
478488
Whether to show `can't find Cargo.toml` error message.
479489
--
480-
[[rust-analyzer.primeCaches.enable]]rust-analyzer.primeCaches.enable (default: `true`)::
481-
+
482-
--
483-
Warm up caches on project load.
484-
--
485-
[[rust-analyzer.primeCaches.numThreads]]rust-analyzer.primeCaches.numThreads (default: `0`)::
486-
+
487-
--
488-
How many worker threads to to handle priming caches. The default `0` means to pick automatically.
489-
--
490490
[[rust-analyzer.procMacro.attributes.enable]]rust-analyzer.procMacro.attributes.enable (default: `true`)::
491491
+
492492
--

editors/code/package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,18 @@
381381
"Fill missing expressions with reasonable defaults, `new` or `default` constructors."
382382
]
383383
},
384+
"rust-analyzer.cachePriming.enable": {
385+
"markdownDescription": "Warm up caches on project load.",
386+
"default": true,
387+
"type": "boolean"
388+
},
389+
"rust-analyzer.cachePriming.numThreads": {
390+
"markdownDescription": "How many worker threads to to handle priming caches. The default `0` means to pick automatically.",
391+
"default": 0,
392+
"type": "number",
393+
"minimum": 0,
394+
"maximum": 255
395+
},
384396
"rust-analyzer.cargo.autoreload": {
385397
"markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` or `.cargo/config.toml` changes.",
386398
"default": true,
@@ -918,18 +930,6 @@
918930
"default": true,
919931
"type": "boolean"
920932
},
921-
"rust-analyzer.primeCaches.enable": {
922-
"markdownDescription": "Warm up caches on project load.",
923-
"default": true,
924-
"type": "boolean"
925-
},
926-
"rust-analyzer.primeCaches.numThreads": {
927-
"markdownDescription": "How many worker threads to to handle priming caches. The default `0` means to pick automatically.",
928-
"default": 0,
929-
"type": "number",
930-
"minimum": 0,
931-
"maximum": 255
932-
},
933933
"rust-analyzer.procMacro.attributes.enable": {
934934
"markdownDescription": "Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.",
935935
"default": true,

editors/code/src/config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ export async function updateConfig(config: vscode.WorkspaceConfiguration) {
146146
["assist.importMergeBehaviour", "imports.granularity.group",],
147147
["assist.importGroup", "imports.group.enable",],
148148
["assist.importPrefix", "imports.prefix",],
149-
["cache.warmup", "primeCaches.enable",],
149+
["primeCaches.enable", "cachePriming.enable",],
150+
["cache.warmup", "cachePriming.enable",],
150151
["cargo.loadOutDirsFromCheck", "cargo.buildScripts.enable",],
151152
["cargo.runBuildScripts", "cargo.buildScripts.enable",],
152153
["cargo.runBuildScriptsCommand", "cargo.buildScripts.overrideCommand",],

0 commit comments

Comments
 (0)