diff options
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 21 | ||||
-rw-r--r-- | editors/code/package.json | 14 |
2 files changed, 33 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index f3d8773cc..04f5bb473 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -133,13 +133,30 @@ impl Config { | |||
133 | set(value, "/cargo/allFeatures", &mut self.cargo.all_features); | 133 | set(value, "/cargo/allFeatures", &mut self.cargo.all_features); |
134 | set(value, "/cargo/features", &mut self.cargo.features); | 134 | set(value, "/cargo/features", &mut self.cargo.features); |
135 | set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check); | 135 | set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check); |
136 | if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { | 136 | if let Some(mut args) = get::<Vec<String>>(value, "/rustfmt/overrideCommand") { |
137 | if !args.is_empty() { | ||
138 | let command = args.remove(0); | ||
139 | self.rustfmt = RustfmtConfig::CustomCommand { | ||
140 | command, | ||
141 | args, | ||
142 | } | ||
143 | } | ||
144 | } else if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { | ||
137 | set(value, "/rustfmt/extraArgs", extra_args); | 145 | set(value, "/rustfmt/extraArgs", extra_args); |
138 | } | 146 | } |
139 | if let Some(false) = get(value, "/checkOnSave/enable") { | 147 | if let Some(false) = get(value, "/checkOnSave/enable") { |
140 | self.check = None | 148 | self.check = None |
141 | } else { | 149 | } else { |
142 | if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check | 150 | if let Some(mut args) = get::<Vec<String>>(value, "/checkOnSave/overrideCommand") { |
151 | if !args.is_empty() { | ||
152 | let command = args.remove(0); | ||
153 | self.check = Some(FlycheckConfig::CustomCommand { | ||
154 | command, | ||
155 | args, | ||
156 | }) | ||
157 | } | ||
158 | |||
159 | } else if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check | ||
143 | { | 160 | { |
144 | set(value, "/checkOnSave/extraArgs", extra_args); | 161 | set(value, "/checkOnSave/extraArgs", extra_args); |
145 | set(value, "/checkOnSave/command", command); | 162 | set(value, "/checkOnSave/command", command); |
diff --git a/editors/code/package.json b/editors/code/package.json index 1f95cd130..e1c34c6ad 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -248,6 +248,13 @@ | |||
248 | "default": [], | 248 | "default": [], |
249 | "description": "Additional arguments to rustfmt" | 249 | "description": "Additional arguments to rustfmt" |
250 | }, | 250 | }, |
251 | "rust-analyzer.rustfmt.overrideCommand": { | ||
252 | "type": "array", | ||
253 | "items": { | ||
254 | "type": "string" | ||
255 | }, | ||
256 | "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for formatting." | ||
257 | }, | ||
251 | "rust-analyzer.checkOnSave.enable": { | 258 | "rust-analyzer.checkOnSave.enable": { |
252 | "type": "boolean", | 259 | "type": "boolean", |
253 | "default": true, | 260 | "default": true, |
@@ -266,6 +273,13 @@ | |||
266 | "default": "check", | 273 | "default": "check", |
267 | "markdownDescription": "Cargo command to use for `cargo check`" | 274 | "markdownDescription": "Cargo command to use for `cargo check`" |
268 | }, | 275 | }, |
276 | "rust-analyzer.checkOnSave.overrideCommand": { | ||
277 | "type": "array", | ||
278 | "items": { | ||
279 | "type": "string" | ||
280 | }, | ||
281 | "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for checking. The command must include `--message=format=json`." | ||
282 | }, | ||
269 | "rust-analyzer.checkOnSave.allTargets": { | 283 | "rust-analyzer.checkOnSave.allTargets": { |
270 | "type": "boolean", | 284 | "type": "boolean", |
271 | "default": true, | 285 | "default": true, |