Skip to content

Commit 16a76aa

Browse files
bors[bot]matklad
andauthored
Merge #7868
7868: Migrate to user-centric config name for `cargo check` stuff r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents 7275750 + 3d80e0a commit 16a76aa

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ config_data! {
4646
cargo_allFeatures: bool = "false",
4747
/// List of features to activate.
4848
cargo_features: Vec<String> = "[]",
49-
/// Run `cargo check` on startup to get the correct value for package
50-
/// OUT_DIRs.
49+
/// Run build scripts (`build.rs`) for more precise code analysis.
50+
cargo_runBuildScripts |
5151
cargo_loadOutDirsFromCheck: bool = "false",
5252
/// Do not activate the `default` feature.
5353
cargo_noDefaultFeatures: bool = "false",
@@ -167,8 +167,7 @@ config_data! {
167167
/// Whether to show `can't find Cargo.toml` error message.
168168
notifications_cargoTomlNotFound: bool = "true",
169169

170-
/// Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be
171-
/// enabled.
170+
/// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
172171
procMacro_enable: bool = "false",
173172
/// Internal config, path to proc-macro server executable (typically,
174173
/// this is rust-analyzer itself, but we override this in tests).
@@ -480,8 +479,8 @@ impl Config {
480479
pub fn cargo_autoreload(&self) -> bool {
481480
self.data.cargo_autoreload
482481
}
483-
pub fn load_out_dirs_from_check(&self) -> bool {
484-
self.data.cargo_loadOutDirsFromCheck
482+
pub fn run_build_scripts(&self) -> bool {
483+
self.data.cargo_runBuildScripts || self.data.procMacro_enable
485484
}
486485
pub fn cargo(&self) -> CargoConfig {
487486
let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| {

crates/rust-analyzer/src/main_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl GlobalState {
312312
} else {
313313
assert_eq!(n_done, n_total);
314314
new_status = Status::Ready {
315-
partial: self.config.load_out_dirs_from_check()
315+
partial: self.config.run_build_scripts()
316316
&& self.workspace_build_data.is_none()
317317
|| config_version < self.vfs_config_version,
318318
};

crates/rust-analyzer/src/reload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl GlobalState {
337337
};
338338
change.set_crate_graph(crate_graph);
339339

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() {
341341
let mut collector = BuildDataCollector::default();
342342
for ws in &workspaces {
343343
ws.collect_build_data_configs(&mut collector);

docs/user/generated_config.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
Activate all available features (`--all-features`).
1111
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
1212
List of features to activate.
13-
[[rust-analyzer.cargo.loadOutDirsFromCheck]]rust-analyzer.cargo.loadOutDirsFromCheck (default: `false`)::
14-
Run `cargo check` on startup to get the correct value for package OUT_DIRs.
13+
[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `false`)::
14+
Run build scripts (`build.rs`) for more precise code analysis.
1515
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
1616
Do not activate the `default` feature.
1717
[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::
@@ -97,7 +97,7 @@
9797
[[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`)::
9898
Whether to show `can't find Cargo.toml` error message.
9999
[[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#`.
101101
[[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`)::
102102
Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests).
103103
[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`)::

editors/code/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@
408408
"type": "string"
409409
}
410410
},
411-
"rust-analyzer.cargo.loadOutDirsFromCheck": {
412-
"markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs.",
411+
"rust-analyzer.cargo.runBuildScripts": {
412+
"markdownDescription": "Run build scripts (`build.rs`) for more precise code analysis.",
413413
"default": false,
414414
"type": "boolean"
415415
},
@@ -678,7 +678,7 @@
678678
"type": "boolean"
679679
},
680680
"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#`.",
682682
"default": false,
683683
"type": "boolean"
684684
},

0 commit comments

Comments
 (0)