add the allFeatures flag (true by default)

This commit is contained in:
guigui64 2020-05-05 22:44:39 +02:00
parent d38741f681
commit c22660179c
No known key found for this signature in database
GPG key ID: 0D90BD8F357E730F
3 changed files with 13 additions and 3 deletions

View file

@ -24,7 +24,7 @@ pub use crate::conv::url_from_path_with_drive_lowercasing;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FlycheckConfig {
CargoCommand { command: String, all_targets: bool, extra_args: Vec<String> },
CargoCommand { command: String, all_targets: bool, all_features: bool, extra_args: Vec<String> },
CustomCommand { command: String, args: Vec<String> },
}
@ -215,7 +215,7 @@ impl FlycheckThread {
self.check_process = None;
let mut cmd = match &self.config {
FlycheckConfig::CargoCommand { command, all_targets, extra_args } => {
FlycheckConfig::CargoCommand { command, all_targets, all_features, extra_args } => {
let mut cmd = Command::new(cargo_binary());
cmd.arg(command);
cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]);
@ -223,6 +223,9 @@ impl FlycheckThread {
if *all_targets {
cmd.arg("--all-targets");
}
if *all_features {
cmd.arg("--all-features");
}
cmd.args(extra_args);
cmd
}

View file

@ -89,6 +89,7 @@ impl Default for Config {
check: Some(FlycheckConfig::CargoCommand {
command: "check".to_string(),
all_targets: true,
all_features: true,
extra_args: Vec::new(),
}),
@ -173,12 +174,13 @@ impl Config {
}
// otherwise configure command customizations
_ => {
if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets })
if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets, all_features })
= &mut self.check
{
set(value, "/checkOnSave/extraArgs", extra_args);
set(value, "/checkOnSave/command", command);
set(value, "/checkOnSave/allTargets", all_targets);
set(value, "/checkOnSave/allFeatures", all_features);
}
}
};

View file

@ -296,6 +296,11 @@
"default": true,
"markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)"
},
"rust-analyzer.checkOnSave.allFeatures": {
"type": "boolean",
"default": true,
"markdownDescription": "Check with all features (will be passed as `--all-features`)"
},
"rust-analyzer.inlayHints.typeHints": {
"type": "boolean",
"default": true,