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>
This commit is contained in:
bors[bot] 2021-03-04 12:39:36 +00:00 committed by GitHub
commit 16a76aa158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 14 deletions

View file

@ -46,8 +46,8 @@ config_data! {
cargo_allFeatures: bool = "false", cargo_allFeatures: bool = "false",
/// List of features to activate. /// List of features to activate.
cargo_features: Vec<String> = "[]", cargo_features: Vec<String> = "[]",
/// Run `cargo check` on startup to get the correct value for package /// Run build scripts (`build.rs`) for more precise code analysis.
/// OUT_DIRs. cargo_runBuildScripts |
cargo_loadOutDirsFromCheck: bool = "false", cargo_loadOutDirsFromCheck: bool = "false",
/// Do not activate the `default` feature. /// Do not activate the `default` feature.
cargo_noDefaultFeatures: bool = "false", cargo_noDefaultFeatures: bool = "false",
@ -167,8 +167,7 @@ config_data! {
/// Whether to show `can't find Cargo.toml` error message. /// Whether to show `can't find Cargo.toml` error message.
notifications_cargoTomlNotFound: bool = "true", notifications_cargoTomlNotFound: bool = "true",
/// Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be /// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
/// enabled.
procMacro_enable: bool = "false", procMacro_enable: bool = "false",
/// Internal config, path to proc-macro server executable (typically, /// Internal config, path to proc-macro server executable (typically,
/// this is rust-analyzer itself, but we override this in tests). /// this is rust-analyzer itself, but we override this in tests).
@ -480,8 +479,8 @@ impl Config {
pub fn cargo_autoreload(&self) -> bool { pub fn cargo_autoreload(&self) -> bool {
self.data.cargo_autoreload self.data.cargo_autoreload
} }
pub fn load_out_dirs_from_check(&self) -> bool { pub fn run_build_scripts(&self) -> bool {
self.data.cargo_loadOutDirsFromCheck self.data.cargo_runBuildScripts || self.data.procMacro_enable
} }
pub fn cargo(&self) -> CargoConfig { pub fn cargo(&self) -> CargoConfig {
let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| { let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| {

View file

@ -312,7 +312,7 @@ impl GlobalState {
} else { } else {
assert_eq!(n_done, n_total); assert_eq!(n_done, n_total);
new_status = Status::Ready { new_status = Status::Ready {
partial: self.config.load_out_dirs_from_check() partial: self.config.run_build_scripts()
&& self.workspace_build_data.is_none() && self.workspace_build_data.is_none()
|| config_version < self.vfs_config_version, || config_version < self.vfs_config_version,
}; };

View file

@ -337,7 +337,7 @@ impl GlobalState {
}; };
change.set_crate_graph(crate_graph); change.set_crate_graph(crate_graph);
if self.config.load_out_dirs_from_check() && workspace_build_data.is_none() { if self.config.run_build_scripts() && workspace_build_data.is_none() {
let mut collector = BuildDataCollector::default(); let mut collector = BuildDataCollector::default();
for ws in &workspaces { for ws in &workspaces {
ws.collect_build_data_configs(&mut collector); ws.collect_build_data_configs(&mut collector);

View file

@ -10,8 +10,8 @@
Activate all available features (`--all-features`). Activate all available features (`--all-features`).
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`):: [[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
List of features to activate. List of features to activate.
[[rust-analyzer.cargo.loadOutDirsFromCheck]]rust-analyzer.cargo.loadOutDirsFromCheck (default: `false`):: [[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `false`)::
Run `cargo check` on startup to get the correct value for package OUT_DIRs. Run build scripts (`build.rs`) for more precise code analysis.
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`):: [[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
Do not activate the `default` feature. Do not activate the `default` feature.
[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`):: [[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::
@ -97,7 +97,7 @@
[[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`):: [[rust-analyzer.notifications.cargoTomlNotFound]]rust-analyzer.notifications.cargoTomlNotFound (default: `true`)::
Whether to show `can't find Cargo.toml` error message. Whether to show `can't find Cargo.toml` error message.
[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`):: [[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`)::
Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be enabled. Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
[[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`):: [[rust-analyzer.procMacro.server]]rust-analyzer.procMacro.server (default: `null`)::
Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests). Internal config, path to proc-macro server executable (typically, this is rust-analyzer itself, but we override this in tests).
[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`):: [[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`)::

View file

@ -408,8 +408,8 @@
"type": "string" "type": "string"
} }
}, },
"rust-analyzer.cargo.loadOutDirsFromCheck": { "rust-analyzer.cargo.runBuildScripts": {
"markdownDescription": "Run `cargo check` on startup to get the correct value for package OUT_DIRs.", "markdownDescription": "Run build scripts (`build.rs`) for more precise code analysis.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
}, },
@ -678,7 +678,7 @@
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.procMacro.enable": { "rust-analyzer.procMacro.enable": {
"markdownDescription": "Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be enabled.", "markdownDescription": "Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
}, },