diff options
Diffstat (limited to 'crates/rust-analyzer/src/config.rs')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 42e1ad376..0ab4c37bf 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -38,6 +38,7 @@ pub struct Config { | |||
38 | pub cargo: CargoConfig, | 38 | pub cargo: CargoConfig, |
39 | pub rustfmt: RustfmtConfig, | 39 | pub rustfmt: RustfmtConfig, |
40 | pub flycheck: Option<FlycheckConfig>, | 40 | pub flycheck: Option<FlycheckConfig>, |
41 | pub runnables: RunnablesConfig, | ||
41 | 42 | ||
42 | pub inlay_hints: InlayHintsConfig, | 43 | pub inlay_hints: InlayHintsConfig, |
43 | pub completion: CompletionConfig, | 44 | pub completion: CompletionConfig, |
@@ -124,6 +125,15 @@ pub enum RustfmtConfig { | |||
124 | CustomCommand { command: String, args: Vec<String> }, | 125 | CustomCommand { command: String, args: Vec<String> }, |
125 | } | 126 | } |
126 | 127 | ||
128 | /// Configuration for runnable items, such as `main` function or tests. | ||
129 | #[derive(Debug, Clone, Default)] | ||
130 | pub struct RunnablesConfig { | ||
131 | /// Custom command to be executed instead of `cargo` for runnables. | ||
132 | pub override_cargo: Option<String>, | ||
133 | /// Additional arguments for the `cargo`, e.g. `--release`. | ||
134 | pub cargo_extra_args: Vec<String>, | ||
135 | } | ||
136 | |||
127 | #[derive(Debug, Clone, Default)] | 137 | #[derive(Debug, Clone, Default)] |
128 | pub struct ClientCapsConfig { | 138 | pub struct ClientCapsConfig { |
129 | pub location_link: bool, | 139 | pub location_link: bool, |
@@ -164,6 +174,7 @@ impl Config { | |||
164 | extra_args: Vec::new(), | 174 | extra_args: Vec::new(), |
165 | features: Vec::new(), | 175 | features: Vec::new(), |
166 | }), | 176 | }), |
177 | runnables: RunnablesConfig::default(), | ||
167 | 178 | ||
168 | inlay_hints: InlayHintsConfig { | 179 | inlay_hints: InlayHintsConfig { |
169 | type_hints: true, | 180 | type_hints: true, |
@@ -220,6 +231,10 @@ impl Config { | |||
220 | load_out_dirs_from_check: data.cargo_loadOutDirsFromCheck, | 231 | load_out_dirs_from_check: data.cargo_loadOutDirsFromCheck, |
221 | target: data.cargo_target.clone(), | 232 | target: data.cargo_target.clone(), |
222 | }; | 233 | }; |
234 | self.runnables = RunnablesConfig { | ||
235 | override_cargo: data.runnables_overrideCargo, | ||
236 | cargo_extra_args: data.runnables_cargoExtraArgs, | ||
237 | }; | ||
223 | 238 | ||
224 | self.proc_macro_srv = if data.procMacro_enable { | 239 | self.proc_macro_srv = if data.procMacro_enable { |
225 | std::env::current_exe().ok().map(|path| (path, vec!["proc-macro".into()])) | 240 | std::env::current_exe().ok().map(|path| (path, vec!["proc-macro".into()])) |
@@ -474,6 +489,9 @@ config_data! { | |||
474 | notifications_cargoTomlNotFound: bool = true, | 489 | notifications_cargoTomlNotFound: bool = true, |
475 | procMacro_enable: bool = false, | 490 | procMacro_enable: bool = false, |
476 | 491 | ||
492 | runnables_overrideCargo: Option<String> = None, | ||
493 | runnables_cargoExtraArgs: Vec<String> = Vec::new(), | ||
494 | |||
477 | rustfmt_extraArgs: Vec<String> = Vec::new(), | 495 | rustfmt_extraArgs: Vec<String> = Vec::new(), |
478 | rustfmt_overrideCommand: Option<Vec<String>> = None, | 496 | rustfmt_overrideCommand: Option<Vec<String>> = None, |
479 | 497 | ||