Auto merge of #12223 - Veykril:config-stuff, r=Veykril

internal: Rename primeCaches config keys
This commit is contained in:
bors 2022-05-12 10:30:37 +00:00
commit 7a55863c3d
5 changed files with 36 additions and 34 deletions

View File

@ -57,6 +57,11 @@ config_data! {
/// Placeholder expression to use for missing expressions in assists.
assist_expressionFillDefault: ExprFillDefaultDef = "\"todo\"",
/// Warm up caches on project load.
cachePriming_enable: bool = "true",
/// How many worker threads to to handle priming caches. The default `0` means to pick automatically.
cachePriming_numThreads: ParallelCachePrimingNumThreads = "0",
/// Automatically refresh project info via `cargo metadata` on
/// `Cargo.toml` or `.cargo/config.toml` changes.
cargo_autoreload: bool = "true",
@ -320,11 +325,6 @@ config_data! {
/// Whether to show `can't find Cargo.toml` error message.
notifications_cargoTomlNotFound: bool = "true",
/// Warm up caches on project load.
primeCaches_enable: bool = "true",
/// How many worker threads to to handle priming caches. The default `0` means to pick automatically.
primeCaches_numThreads: ParallelPrimeCachesNumThreads = "0",
/// Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.
procMacro_attributes_enable: bool = "true",
/// Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.
@ -402,7 +402,7 @@ pub struct Config {
snippets: Vec<Snippet>,
}
type ParallelPrimeCachesNumThreads = u8;
type ParallelCachePrimingNumThreads = u8;
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum LinkedProject {
@ -716,7 +716,7 @@ impl Config {
}
pub fn prefill_caches(&self) -> bool {
self.data.primeCaches_enable
self.data.cachePriming_enable
}
pub fn location_link(&self) -> bool {
@ -1189,7 +1189,7 @@ impl Config {
}
pub fn prime_caches_num_threads(&self) -> u8 {
match self.data.primeCaches_numThreads {
match self.data.cachePriming_numThreads {
0 => num_cpus::get_physical().try_into().unwrap_or(u8::MAX),
n => n,
}
@ -1661,7 +1661,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
"Search for all symbols kinds"
],
},
"ParallelPrimeCachesNumThreads" => set! {
"ParallelCachePrimingNumThreads" => set! {
"type": "number",
"minimum": 0,
"maximum": 255

View File

@ -34,7 +34,8 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
assist.importMergeBehaviour -> imports.granularity.group;
assist.importGroup -> imports.group.enable;
assist.importPrefix -> imports.prefix;
cache.warmup -> primeCaches.enable;
primeCaches.enable -> cachePriming.enable;
cache.warmup -> cachePriming.enable;
cargo.loadOutDirsFromCheck -> cargo.buildScripts.enable;
cargo.runBuildScripts -> cargo.buildScripts.enable;
cargo.runBuildScriptsCommand -> cargo.buildScripts.overrideCommand;
@ -50,7 +51,7 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
hover.linksInHover -> hover.links.enable;
hoverActions.linksInHover -> hover.links.enable;
hoverActions.debug -> hoverActions.debug.enable;
hoverActions.enable -> hoverActions.enable.enable;
hoverActions.enable -> hoverActions.enable;
hoverActions.gotoTypeDef -> hoverActions.gotoTypeDef.enable;
hoverActions.implementations -> hoverActions.implementations.enable;
hoverActions.references -> hoverActions.references.enable;

View File

@ -3,6 +3,16 @@
--
Placeholder expression to use for missing expressions in assists.
--
[[rust-analyzer.cachePriming.enable]]rust-analyzer.cachePriming.enable (default: `true`)::
+
--
Warm up caches on project load.
--
[[rust-analyzer.cachePriming.numThreads]]rust-analyzer.cachePriming.numThreads (default: `0`)::
+
--
How many worker threads to to handle priming caches. The default `0` means to pick automatically.
--
[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`)::
+
--
@ -477,16 +487,6 @@ Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
--
Whether to show `can't find Cargo.toml` error message.
--
[[rust-analyzer.primeCaches.enable]]rust-analyzer.primeCaches.enable (default: `true`)::
+
--
Warm up caches on project load.
--
[[rust-analyzer.primeCaches.numThreads]]rust-analyzer.primeCaches.numThreads (default: `0`)::
+
--
How many worker threads to to handle priming caches. The default `0` means to pick automatically.
--
[[rust-analyzer.procMacro.attributes.enable]]rust-analyzer.procMacro.attributes.enable (default: `true`)::
+
--

View File

@ -381,6 +381,18 @@
"Fill missing expressions with reasonable defaults, `new` or `default` constructors."
]
},
"rust-analyzer.cachePriming.enable": {
"markdownDescription": "Warm up caches on project load.",
"default": true,
"type": "boolean"
},
"rust-analyzer.cachePriming.numThreads": {
"markdownDescription": "How many worker threads to to handle priming caches. The default `0` means to pick automatically.",
"default": 0,
"type": "number",
"minimum": 0,
"maximum": 255
},
"rust-analyzer.cargo.autoreload": {
"markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` or `.cargo/config.toml` changes.",
"default": true,
@ -918,18 +930,6 @@
"default": true,
"type": "boolean"
},
"rust-analyzer.primeCaches.enable": {
"markdownDescription": "Warm up caches on project load.",
"default": true,
"type": "boolean"
},
"rust-analyzer.primeCaches.numThreads": {
"markdownDescription": "How many worker threads to to handle priming caches. The default `0` means to pick automatically.",
"default": 0,
"type": "number",
"minimum": 0,
"maximum": 255
},
"rust-analyzer.procMacro.attributes.enable": {
"markdownDescription": "Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.",
"default": true,

View File

@ -146,7 +146,8 @@ export async function updateConfig(config: vscode.WorkspaceConfiguration) {
["assist.importMergeBehaviour", "imports.granularity.group",],
["assist.importGroup", "imports.group.enable",],
["assist.importPrefix", "imports.prefix",],
["cache.warmup", "primeCaches.enable",],
["primeCaches.enable", "cachePriming.enable",],
["cache.warmup", "cachePriming.enable",],
["cargo.loadOutDirsFromCheck", "cargo.buildScripts.enable",],
["cargo.runBuildScripts", "cargo.buildScripts.enable",],
["cargo.runBuildScriptsCommand", "cargo.buildScripts.overrideCommand",],