diff options
author | Aleksey Kladov <[email protected]> | 2021-03-04 11:52:36 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-03-04 12:38:53 +0000 |
commit | 3d80e0a15417ccf731a68e3100dfb4c7619c9274 (patch) | |
tree | f8dbb7d935d57f0f24bb57128af5d2440148dfbe /crates | |
parent | 0ce539ec969125dd757f06ef97a75f89876b07c5 (diff) |
Migrate to user-centric config name for `cargo check` stuff
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 11 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/reload.rs | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 556fc2eeb..367136702 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -46,8 +46,8 @@ config_data! { | |||
46 | cargo_allFeatures: bool = "false", | 46 | cargo_allFeatures: bool = "false", |
47 | /// List of features to activate. | 47 | /// List of features to activate. |
48 | cargo_features: Vec<String> = "[]", | 48 | cargo_features: Vec<String> = "[]", |
49 | /// Run `cargo check` on startup to get the correct value for package | 49 | /// Run build scripts (`build.rs`) for more precise code analysis. |
50 | /// OUT_DIRs. | 50 | cargo_runBuildScripts | |
51 | cargo_loadOutDirsFromCheck: bool = "false", | 51 | cargo_loadOutDirsFromCheck: bool = "false", |
52 | /// Do not activate the `default` feature. | 52 | /// Do not activate the `default` feature. |
53 | cargo_noDefaultFeatures: bool = "false", | 53 | cargo_noDefaultFeatures: bool = "false", |
@@ -167,8 +167,7 @@ config_data! { | |||
167 | /// Whether to show `can't find Cargo.toml` error message. | 167 | /// Whether to show `can't find Cargo.toml` error message. |
168 | notifications_cargoTomlNotFound: bool = "true", | 168 | notifications_cargoTomlNotFound: bool = "true", |
169 | 169 | ||
170 | /// Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be | 170 | /// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`. |
171 | /// enabled. | ||
172 | procMacro_enable: bool = "false", | 171 | procMacro_enable: bool = "false", |
173 | /// Internal config, path to proc-macro server executable (typically, | 172 | /// Internal config, path to proc-macro server executable (typically, |
174 | /// this is rust-analyzer itself, but we override this in tests). | 173 | /// this is rust-analyzer itself, but we override this in tests). |
@@ -480,8 +479,8 @@ impl Config { | |||
480 | pub fn cargo_autoreload(&self) -> bool { | 479 | pub fn cargo_autoreload(&self) -> bool { |
481 | self.data.cargo_autoreload | 480 | self.data.cargo_autoreload |
482 | } | 481 | } |
483 | pub fn load_out_dirs_from_check(&self) -> bool { | 482 | pub fn run_build_scripts(&self) -> bool { |
484 | self.data.cargo_loadOutDirsFromCheck | 483 | self.data.cargo_runBuildScripts || self.data.procMacro_enable |
485 | } | 484 | } |
486 | pub fn cargo(&self) -> CargoConfig { | 485 | pub fn cargo(&self) -> CargoConfig { |
487 | let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| { | 486 | let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| { |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 2829d5970..f0cb309e4 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -312,7 +312,7 @@ impl GlobalState { | |||
312 | } else { | 312 | } else { |
313 | assert_eq!(n_done, n_total); | 313 | assert_eq!(n_done, n_total); |
314 | new_status = Status::Ready { | 314 | new_status = Status::Ready { |
315 | partial: self.config.load_out_dirs_from_check() | 315 | partial: self.config.run_build_scripts() |
316 | && self.workspace_build_data.is_none() | 316 | && self.workspace_build_data.is_none() |
317 | || config_version < self.vfs_config_version, | 317 | || config_version < self.vfs_config_version, |
318 | }; | 318 | }; |
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index c07efa330..aa8504c3d 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs | |||
@@ -337,7 +337,7 @@ impl GlobalState { | |||
337 | }; | 337 | }; |
338 | change.set_crate_graph(crate_graph); | 338 | change.set_crate_graph(crate_graph); |
339 | 339 | ||
340 | if self.config.load_out_dirs_from_check() && workspace_build_data.is_none() { | 340 | if self.config.run_build_scripts() && workspace_build_data.is_none() { |
341 | let mut collector = BuildDataCollector::default(); | 341 | let mut collector = BuildDataCollector::default(); |
342 | for ws in &workspaces { | 342 | for ws in &workspaces { |
343 | ws.collect_build_data_configs(&mut collector); | 343 | ws.collect_build_data_configs(&mut collector); |