aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-04 11:52:36 +0000
committerAleksey Kladov <[email protected]>2021-03-04 12:38:53 +0000
commit3d80e0a15417ccf731a68e3100dfb4c7619c9274 (patch)
treef8dbb7d935d57f0f24bb57128af5d2440148dfbe
parent0ce539ec969125dd757f06ef97a75f89876b07c5 (diff)
Migrate to user-centric config name for `cargo check` stuff
-rw-r--r--crates/rust-analyzer/src/config.rs11
-rw-r--r--crates/rust-analyzer/src/main_loop.rs2
-rw-r--r--crates/rust-analyzer/src/reload.rs2
-rw-r--r--docs/user/generated_config.adoc6
-rw-r--r--editors/code/package.json6
5 files changed, 13 insertions, 14 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);
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index f91e04c31..1dbf2a611 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -10,8 +10,8 @@
10 Activate all available features (`--all-features`). 10 Activate all available features (`--all-features`).
11[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`):: 11[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
12 List of features to activate. 12 List of features to activate.
13[[rust-analyzer.cargo.loadOutDirsFromCheck]]rust-analyzer.cargo.loadOutDirsFromCheck (default: `false`):: 13[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `false`)::
14 Run `cargo check` on startup to get the correct value for package OUT_DIRs. 14 Run build scripts (`build.rs`) for more precise code analysis.
15[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`):: 15[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
16 Do not activate the `default` feature. 16 Do not activate the `default` feature.
17[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`):: 17[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::
@@ -97,7 +97,7 @@
97[[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`):: 97[[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`)::
98 Whether to show `can't find Cargo.toml` error message. 98 Whether to show `can't find Cargo.toml` error message.
99[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`):: 99[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`)::
100 Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be enabled. 100 Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
101[[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`):: 101[[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`)::
102 Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests). 102 Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests).
103[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`):: 103[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`)::
diff --git a/editors/code/package.json b/editors/code/package.json
index e3e0ebff0..1987364bc 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -408,8 +408,8 @@
408 "type": "string" 408 "type": "string"
409 } 409 }
410 }, 410 },
411 "rust-analyzer.cargo.loadOutDirsFromCheck": { 411 "rust-analyzer.cargo.runBuildScripts": {
412 "markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs.", 412 "markdownDescription": "Run build scripts (`build.rs`) for more precise code analysis.",
413 "default": false, 413 "default": false,
414 "type": "boolean" 414 "type": "boolean"
415 }, 415 },
@@ -678,7 +678,7 @@
678 "type": "boolean" 678 "type": "boolean"
679 }, 679 },
680 "rust-analyzer.procMacro.enable": { 680 "rust-analyzer.procMacro.enable": {
681 "markdownDescription": "Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be enabled.", 681 "markdownDescription": "Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.",
682 "default": false, 682 "default": false,
683 "type": "boolean" 683 "type": "boolean"
684 }, 684 },