diff options
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_stats.rs | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/diagnostics.rs | 8 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/load_cargo.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/ssr.rs | 9 | ||||
-rw-r--r-- | crates/rust-analyzer/src/integrated_benchmarks.rs | 2 |
5 files changed, 21 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index 5364e907c..843c0ca37 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -70,6 +70,7 @@ impl AnalysisStatsCmd { | |||
70 | load_out_dirs_from_check: self.enable_build_scripts, | 70 | load_out_dirs_from_check: self.enable_build_scripts, |
71 | wrap_rustc: false, | 71 | wrap_rustc: false, |
72 | with_proc_macro: self.enable_proc_macros, | 72 | with_proc_macro: self.enable_proc_macros, |
73 | prefill_caches: false, | ||
73 | }; | 74 | }; |
74 | let (host, vfs, _proc_macro) = | 75 | let (host, vfs, _proc_macro) = |
75 | load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?; | 76 | load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?; |
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs index c33c8179c..dc9a390fe 100644 --- a/crates/rust-analyzer/src/cli/diagnostics.rs +++ b/crates/rust-analyzer/src/cli/diagnostics.rs | |||
@@ -34,8 +34,12 @@ pub fn diagnostics( | |||
34 | with_proc_macro: bool, | 34 | with_proc_macro: bool, |
35 | ) -> Result<()> { | 35 | ) -> Result<()> { |
36 | let cargo_config = Default::default(); | 36 | let cargo_config = Default::default(); |
37 | let load_cargo_config = | 37 | let load_cargo_config = LoadCargoConfig { |
38 | LoadCargoConfig { load_out_dirs_from_check, with_proc_macro, wrap_rustc: false }; | 38 | load_out_dirs_from_check, |
39 | with_proc_macro, | ||
40 | wrap_rustc: false, | ||
41 | prefill_caches: false, | ||
42 | }; | ||
39 | let (host, _vfs, _proc_macro) = | 43 | let (host, _vfs, _proc_macro) = |
40 | load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; | 44 | load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; |
41 | let db = host.raw_database(); | 45 | let db = host.raw_database(); |
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 612fa527f..19cb1c046 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -18,6 +18,7 @@ pub(crate) struct LoadCargoConfig { | |||
18 | pub(crate) load_out_dirs_from_check: bool, | 18 | pub(crate) load_out_dirs_from_check: bool, |
19 | pub(crate) wrap_rustc: bool, | 19 | pub(crate) wrap_rustc: bool, |
20 | pub(crate) with_proc_macro: bool, | 20 | pub(crate) with_proc_macro: bool, |
21 | pub(crate) prefill_caches: bool, | ||
21 | } | 22 | } |
22 | 23 | ||
23 | pub(crate) fn load_workspace_at( | 24 | pub(crate) fn load_workspace_at( |
@@ -83,7 +84,9 @@ fn load_workspace( | |||
83 | let host = | 84 | let host = |
84 | load_crate_graph(crate_graph, project_folders.source_root_config, &mut vfs, &receiver); | 85 | load_crate_graph(crate_graph, project_folders.source_root_config, &mut vfs, &receiver); |
85 | 86 | ||
86 | host.analysis().prime_caches(|_| {})?; | 87 | if config.prefill_caches { |
88 | host.analysis().prime_caches(|_| {})?; | ||
89 | } | ||
87 | Ok((host, vfs, proc_macro_client)) | 90 | Ok((host, vfs, proc_macro_client)) |
88 | } | 91 | } |
89 | 92 | ||
@@ -146,6 +149,7 @@ mod tests { | |||
146 | load_out_dirs_from_check: false, | 149 | load_out_dirs_from_check: false, |
147 | wrap_rustc: false, | 150 | wrap_rustc: false, |
148 | with_proc_macro: false, | 151 | with_proc_macro: false, |
152 | prefill_caches: false, | ||
149 | }; | 153 | }; |
150 | let (host, _vfs, _proc_macro) = | 154 | let (host, _vfs, _proc_macro) = |
151 | load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; | 155 | load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; |
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index 1fd9b5a9b..0b3475e09 100644 --- a/crates/rust-analyzer/src/cli/ssr.rs +++ b/crates/rust-analyzer/src/cli/ssr.rs | |||
@@ -13,6 +13,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | |||
13 | load_out_dirs_from_check: true, | 13 | load_out_dirs_from_check: true, |
14 | wrap_rustc: false, | 14 | wrap_rustc: false, |
15 | with_proc_macro: true, | 15 | with_proc_macro: true, |
16 | prefill_caches: false, | ||
16 | }; | 17 | }; |
17 | let (host, vfs, _proc_macro) = | 18 | let (host, vfs, _proc_macro) = |
18 | load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; | 19 | load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; |
@@ -39,8 +40,12 @@ pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<Stri | |||
39 | use ide_db::base_db::SourceDatabaseExt; | 40 | use ide_db::base_db::SourceDatabaseExt; |
40 | use ide_db::symbol_index::SymbolsDatabase; | 41 | use ide_db::symbol_index::SymbolsDatabase; |
41 | let cargo_config = Default::default(); | 42 | let cargo_config = Default::default(); |
42 | let load_cargo_config = | 43 | let load_cargo_config = LoadCargoConfig { |
43 | LoadCargoConfig { load_out_dirs_from_check: true, wrap_rustc: true, with_proc_macro: true }; | 44 | load_out_dirs_from_check: true, |
45 | wrap_rustc: true, | ||
46 | with_proc_macro: true, | ||
47 | prefill_caches: false, | ||
48 | }; | ||
44 | let (host, _vfs, _proc_macro) = | 49 | let (host, _vfs, _proc_macro) = |
45 | load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; | 50 | load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; |
46 | let db = host.raw_database(); | 51 | let db = host.raw_database(); |
diff --git a/crates/rust-analyzer/src/integrated_benchmarks.rs b/crates/rust-analyzer/src/integrated_benchmarks.rs index ec36a5f5c..8ddeb59f7 100644 --- a/crates/rust-analyzer/src/integrated_benchmarks.rs +++ b/crates/rust-analyzer/src/integrated_benchmarks.rs | |||
@@ -37,6 +37,7 @@ fn integrated_highlighting_benchmark() { | |||
37 | load_out_dirs_from_check: true, | 37 | load_out_dirs_from_check: true, |
38 | wrap_rustc: false, | 38 | wrap_rustc: false, |
39 | with_proc_macro: false, | 39 | with_proc_macro: false, |
40 | prefill_caches: false, | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | let (mut host, vfs, _proc_macro) = { | 43 | let (mut host, vfs, _proc_macro) = { |
@@ -91,6 +92,7 @@ fn integrated_completion_benchmark() { | |||
91 | load_out_dirs_from_check: true, | 92 | load_out_dirs_from_check: true, |
92 | wrap_rustc: false, | 93 | wrap_rustc: false, |
93 | with_proc_macro: false, | 94 | with_proc_macro: false, |
95 | prefill_caches: true, | ||
94 | }; | 96 | }; |
95 | 97 | ||
96 | let (mut host, vfs, _proc_macro) = { | 98 | let (mut host, vfs, _proc_macro) = { |