Allow fully overriding check and fmt commands
This commit is contained in:
@@ -133,13 +133,30 @@ impl Config {
|
|||||||
set(value, "/cargo/allFeatures", &mut self.cargo.all_features);
|
set(value, "/cargo/allFeatures", &mut self.cargo.all_features);
|
||||||
set(value, "/cargo/features", &mut self.cargo.features);
|
set(value, "/cargo/features", &mut self.cargo.features);
|
||||||
set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check);
|
set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check);
|
||||||
if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt {
|
if let Some(mut args) = get::<Vec<String>>(value, "/rustfmt/overrideCommand") {
|
||||||
|
if !args.is_empty() {
|
||||||
|
let command = args.remove(0);
|
||||||
|
self.rustfmt = RustfmtConfig::CustomCommand {
|
||||||
|
command,
|
||||||
|
args,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt {
|
||||||
set(value, "/rustfmt/extraArgs", extra_args);
|
set(value, "/rustfmt/extraArgs", extra_args);
|
||||||
}
|
}
|
||||||
if let Some(false) = get(value, "/checkOnSave/enable") {
|
if let Some(false) = get(value, "/checkOnSave/enable") {
|
||||||
self.check = None
|
self.check = None
|
||||||
} else {
|
} else {
|
||||||
if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check
|
if let Some(mut args) = get::<Vec<String>>(value, "/checkOnSave/overrideCommand") {
|
||||||
|
if !args.is_empty() {
|
||||||
|
let command = args.remove(0);
|
||||||
|
self.check = Some(FlycheckConfig::CustomCommand {
|
||||||
|
command,
|
||||||
|
args,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check
|
||||||
{
|
{
|
||||||
set(value, "/checkOnSave/extraArgs", extra_args);
|
set(value, "/checkOnSave/extraArgs", extra_args);
|
||||||
set(value, "/checkOnSave/command", command);
|
set(value, "/checkOnSave/command", command);
|
||||||
|
|||||||
@@ -248,6 +248,13 @@
|
|||||||
"default": [],
|
"default": [],
|
||||||
"description": "Additional arguments to rustfmt"
|
"description": "Additional arguments to rustfmt"
|
||||||
},
|
},
|
||||||
|
"rust-analyzer.rustfmt.overrideCommand": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting."
|
||||||
|
},
|
||||||
"rust-analyzer.checkOnSave.enable": {
|
"rust-analyzer.checkOnSave.enable": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
@@ -266,6 +273,13 @@
|
|||||||
"default": "check",
|
"default": "check",
|
||||||
"markdownDescription": "Cargo command to use for `cargo check`"
|
"markdownDescription": "Cargo command to use for `cargo check`"
|
||||||
},
|
},
|
||||||
|
"rust-analyzer.checkOnSave.overrideCommand": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command must include `--message=format=json`."
|
||||||
|
},
|
||||||
"rust-analyzer.checkOnSave.allTargets": {
|
"rust-analyzer.checkOnSave.allTargets": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user