aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-05 21:49:55 +0100
committerGitHub <[email protected]>2020-05-05 21:49:55 +0100
commit7e941fe8ec7b196314aa05bf9411cdce978ffa24 (patch)
tree00cbf8593507a297aca9338233f55e42d3f4bf92
parentd38741f681c173a96e991dc3c213d4c85dc5a8af (diff)
parentc22660179c3f892a56ad5bacfddd4c2ec563d35e (diff)
Merge #4328
4328: add the allFeatures flag (true by default) r=matklad a=guigui64 As discussed on zulip. Co-authored-by: guigui64 <[email protected]>
-rw-r--r--crates/ra_flycheck/src/lib.rs7
-rw-r--r--crates/rust-analyzer/src/config.rs4
-rw-r--r--editors/code/package.json5
3 files changed, 13 insertions, 3 deletions
diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs
index b54a30ab8..f27252949 100644
--- a/crates/ra_flycheck/src/lib.rs
+++ b/crates/ra_flycheck/src/lib.rs
@@ -24,7 +24,7 @@ pub use crate::conv::url_from_path_with_drive_lowercasing;
24 24
25#[derive(Clone, Debug, PartialEq, Eq)] 25#[derive(Clone, Debug, PartialEq, Eq)]
26pub enum FlycheckConfig { 26pub enum FlycheckConfig {
27 CargoCommand { command: String, all_targets: bool, extra_args: Vec<String> }, 27 CargoCommand { command: String, all_targets: bool, all_features: bool, extra_args: Vec<String> },
28 CustomCommand { command: String, args: Vec<String> }, 28 CustomCommand { command: String, args: Vec<String> },
29} 29}
30 30
@@ -215,7 +215,7 @@ impl FlycheckThread {
215 self.check_process = None; 215 self.check_process = None;
216 216
217 let mut cmd = match &self.config { 217 let mut cmd = match &self.config {
218 FlycheckConfig::CargoCommand { command, all_targets, extra_args } => { 218 FlycheckConfig::CargoCommand { command, all_targets, all_features, extra_args } => {
219 let mut cmd = Command::new(cargo_binary()); 219 let mut cmd = Command::new(cargo_binary());
220 cmd.arg(command); 220 cmd.arg(command);
221 cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]); 221 cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]);
@@ -223,6 +223,9 @@ impl FlycheckThread {
223 if *all_targets { 223 if *all_targets {
224 cmd.arg("--all-targets"); 224 cmd.arg("--all-targets");
225 } 225 }
226 if *all_features {
227 cmd.arg("--all-features");
228 }
226 cmd.args(extra_args); 229 cmd.args(extra_args);
227 cmd 230 cmd
228 } 231 }
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 8d85c60cf..ccc38e3bb 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -89,6 +89,7 @@ impl Default for Config {
89 check: Some(FlycheckConfig::CargoCommand { 89 check: Some(FlycheckConfig::CargoCommand {
90 command: "check".to_string(), 90 command: "check".to_string(),
91 all_targets: true, 91 all_targets: true,
92 all_features: true,
92 extra_args: Vec::new(), 93 extra_args: Vec::new(),
93 }), 94 }),
94 95
@@ -173,12 +174,13 @@ impl Config {
173 } 174 }
174 // otherwise configure command customizations 175 // otherwise configure command customizations
175 _ => { 176 _ => {
176 if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) 177 if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets, all_features })
177 = &mut self.check 178 = &mut self.check
178 { 179 {
179 set(value, "/checkOnSave/extraArgs", extra_args); 180 set(value, "/checkOnSave/extraArgs", extra_args);
180 set(value, "/checkOnSave/command", command); 181 set(value, "/checkOnSave/command", command);
181 set(value, "/checkOnSave/allTargets", all_targets); 182 set(value, "/checkOnSave/allTargets", all_targets);
183 set(value, "/checkOnSave/allFeatures", all_features);
182 } 184 }
183 } 185 }
184 }; 186 };
diff --git a/editors/code/package.json b/editors/code/package.json
index a05a69752..97276339f 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -296,6 +296,11 @@
296 "default": true, 296 "default": true,
297 "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)" 297 "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)"
298 }, 298 },
299 "rust-analyzer.checkOnSave.allFeatures": {
300 "type": "boolean",
301 "default": true,
302 "markdownDescription": "Check with all features (will be passed as `--all-features`)"
303 },
299 "rust-analyzer.inlayHints.typeHints": { 304 "rust-analyzer.inlayHints.typeHints": {
300 "type": "boolean", 305 "type": "boolean",
301 "default": true, 306 "default": true,