mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Add and use rust-analyzer.cargo.extraArgs setting
This commit is contained in:
parent
cfc9d5cd3b
commit
c3864eb511
@ -101,6 +101,8 @@ config_data! {
|
||||
/// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
|
||||
/// avoid checking unnecessary things.
|
||||
cargo_buildScripts_useRustcWrapper: bool = "true",
|
||||
/// Extra arguments that are passed to every cargo invocation.
|
||||
cargo_extraArgs: Vec<String> = "[]",
|
||||
/// Extra environment variables that will be set when running cargo, rustc
|
||||
/// or other commands within the workspace. Useful for setting RUSTFLAGS.
|
||||
cargo_extraEnv: FxHashMap<String, String> = "{}",
|
||||
@ -1055,10 +1057,20 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn extra_args(&self) -> &Vec<String> {
|
||||
&self.data.cargo_extraArgs
|
||||
}
|
||||
|
||||
pub fn extra_env(&self) -> &FxHashMap<String, String> {
|
||||
&self.data.cargo_extraEnv
|
||||
}
|
||||
|
||||
pub fn check_extra_args(&self) -> Vec<String> {
|
||||
let mut extra_args = self.extra_args().clone();
|
||||
extra_args.extend_from_slice(&self.data.check_extraArgs);
|
||||
extra_args
|
||||
}
|
||||
|
||||
pub fn check_extra_env(&self) -> FxHashMap<String, String> {
|
||||
let mut extra_env = self.data.cargo_extraEnv.clone();
|
||||
extra_env.extend(self.data.check_extraEnv.clone());
|
||||
@ -1157,7 +1169,7 @@ impl Config {
|
||||
InvocationLocation::Workspace => project_model::InvocationLocation::Workspace,
|
||||
},
|
||||
run_build_script_command: self.data.cargo_buildScripts_overrideCommand.clone(),
|
||||
extra_args: self.data.check_extraArgs.clone(),
|
||||
extra_args: self.data.cargo_extraArgs.clone(),
|
||||
extra_env: self.data.cargo_extraEnv.clone(),
|
||||
}
|
||||
}
|
||||
@ -1228,7 +1240,7 @@ impl Config {
|
||||
CargoFeaturesDef::All => vec![],
|
||||
CargoFeaturesDef::Selected(it) => it,
|
||||
},
|
||||
extra_args: self.data.check_extraArgs.clone(),
|
||||
extra_args: self.check_extra_args(),
|
||||
extra_env: self.check_extra_env(),
|
||||
ansi_color_output: self.color_diagnostic_output(),
|
||||
},
|
||||
|
@ -71,6 +71,11 @@ cargo check --quiet --workspace --message-format=json --all-targets
|
||||
Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
|
||||
avoid checking unnecessary things.
|
||||
--
|
||||
[[rust-analyzer.cargo.extraArgs]]rust-analyzer.cargo.extraArgs (default: `[]`)::
|
||||
+
|
||||
--
|
||||
Extra arguments that are passed to every cargo invocation.
|
||||
--
|
||||
[[rust-analyzer.cargo.extraEnv]]rust-analyzer.cargo.extraEnv (default: `{}`)::
|
||||
+
|
||||
--
|
||||
|
@ -511,6 +511,14 @@
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rust-analyzer.cargo.extraArgs": {
|
||||
"markdownDescription": "Extra arguments that are passed to every cargo invocation.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"rust-analyzer.cargo.extraEnv": {
|
||||
"markdownDescription": "Extra environment variables that will be set when running cargo, rustc\nor other commands within the workspace. Useful for setting RUSTFLAGS.",
|
||||
"default": {},
|
||||
|
Loading…
Reference in New Issue
Block a user