@@ -298,6 +298,9 @@ config_data! {
298298 /// Whether to show `can't find Cargo.toml` error message.
299299 notifications_cargoTomlNotFound: bool = "true" ,
300300
301+ /// How many worker threads to to handle priming caches. The default `0` means to pick automatically.
302+ primeCaches_numThreads: ParallelPrimeCachesNumThreads = "0" ,
303+
301304 /// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
302305 procMacro_enable: bool = "true" ,
303306 /// Internal config, path to proc-macro server executable (typically,
@@ -1016,6 +1019,13 @@ impl Config {
10161019 yield_points : self . data . highlightRelated_yieldPoints ,
10171020 }
10181021 }
1022+
1023+ pub fn prime_caches_num_threads ( & self ) -> u8 {
1024+ match self . data . primeCaches_numThreads {
1025+ 0 => num_cpus:: get_physical ( ) . try_into ( ) . unwrap_or ( u8:: MAX ) ,
1026+ n => n,
1027+ }
1028+ }
10191029}
10201030
10211031#[ derive( Deserialize , Debug , Clone , Copy ) ]
@@ -1130,6 +1140,8 @@ enum WorkspaceSymbolSearchKindDef {
11301140 AllSymbols ,
11311141}
11321142
1143+ type ParallelPrimeCachesNumThreads = u8 ;
1144+
11331145macro_rules! _config_data {
11341146 ( struct $name: ident {
11351147 $(
@@ -1351,6 +1363,11 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
13511363 "Search for all symbols kinds"
13521364 ] ,
13531365 } ,
1366+ "ParallelPrimeCachesNumThreads" => set ! {
1367+ "type" : "number" ,
1368+ "minimum" : 0 ,
1369+ "maximum" : 255
1370+ } ,
13541371 _ => panic ! ( "{}: {}" , ty, default ) ,
13551372 }
13561373
0 commit comments