diff options
author | Igor Aleksanov <[email protected]> | 2020-09-05 14:20:33 +0100 |
---|---|---|
committer | Igor Aleksanov <[email protected]> | 2020-10-02 10:34:27 +0100 |
commit | 4a1b4b23bb58398a7e2a955e0be43ff2c09fe9e5 (patch) | |
tree | 3658b83b52d347d120fa66a08e3da0a9ef4bd0f4 | |
parent | 2c125f3c638e17837ad44b4a5fd7a96b32018018 (diff) |
Replace 'cargo_prefix' option with 'override_cargo'
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 10 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index c5dd00706..0ab4c37bf 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -128,8 +128,8 @@ pub enum RustfmtConfig { | |||
128 | /// Configuration for runnable items, such as `main` function or tests. | 128 | /// Configuration for runnable items, such as `main` function or tests. |
129 | #[derive(Debug, Clone, Default)] | 129 | #[derive(Debug, Clone, Default)] |
130 | pub struct RunnablesConfig { | 130 | pub struct RunnablesConfig { |
131 | /// Stuff to be inserted before `cargo`, e.g. `RUST_LOG=info`. | 131 | /// Custom command to be executed instead of `cargo` for runnables. |
132 | pub cargo_prefix: Vec<String>, | 132 | pub override_cargo: Option<String>, |
133 | /// Additional arguments for the `cargo`, e.g. `--release`. | 133 | /// Additional arguments for the `cargo`, e.g. `--release`. |
134 | pub cargo_extra_args: Vec<String>, | 134 | pub cargo_extra_args: Vec<String>, |
135 | } | 135 | } |
@@ -232,7 +232,7 @@ impl Config { | |||
232 | target: data.cargo_target.clone(), | 232 | target: data.cargo_target.clone(), |
233 | }; | 233 | }; |
234 | self.runnables = RunnablesConfig { | 234 | self.runnables = RunnablesConfig { |
235 | cargo_prefix: data.runnables_cargoPrefix, | 235 | override_cargo: data.runnables_overrideCargo, |
236 | cargo_extra_args: data.runnables_cargoExtraArgs, | 236 | cargo_extra_args: data.runnables_cargoExtraArgs, |
237 | }; | 237 | }; |
238 | 238 | ||
@@ -489,8 +489,8 @@ config_data! { | |||
489 | notifications_cargoTomlNotFound: bool = true, | 489 | notifications_cargoTomlNotFound: bool = true, |
490 | procMacro_enable: bool = false, | 490 | procMacro_enable: bool = false, |
491 | 491 | ||
492 | runnables_cargoPrefix: Vec<String> = Vec::new(), | 492 | runnables_overrideCargo: Option<String> = None, |
493 | runnables_cargoExtraArgs: Vec<String> = Vec::new(), | 493 | runnables_cargoExtraArgs: Vec<String> = Vec::new(), |
494 | 494 | ||
495 | rustfmt_extraArgs: Vec<String> = Vec::new(), | 495 | rustfmt_extraArgs: Vec<String> = Vec::new(), |
496 | rustfmt_overrideCommand: Option<Vec<String>> = None, | 496 | rustfmt_overrideCommand: Option<Vec<String>> = None, |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 2a8eca146..e970abb7c 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -501,7 +501,7 @@ pub(crate) fn handle_runnables( | |||
501 | kind: lsp_ext::RunnableKind::Cargo, | 501 | kind: lsp_ext::RunnableKind::Cargo, |
502 | args: lsp_ext::CargoRunnable { | 502 | args: lsp_ext::CargoRunnable { |
503 | workspace_root: Some(spec.workspace_root.clone().into()), | 503 | workspace_root: Some(spec.workspace_root.clone().into()), |
504 | cargo_prefix: config.cargo_prefix.clone(), | 504 | override_cargo: config.override_cargo.clone(), |
505 | cargo_args: vec![ | 505 | cargo_args: vec![ |
506 | cmd.to_string(), | 506 | cmd.to_string(), |
507 | "--package".to_string(), | 507 | "--package".to_string(), |
@@ -522,7 +522,7 @@ pub(crate) fn handle_runnables( | |||
522 | kind: lsp_ext::RunnableKind::Cargo, | 522 | kind: lsp_ext::RunnableKind::Cargo, |
523 | args: lsp_ext::CargoRunnable { | 523 | args: lsp_ext::CargoRunnable { |
524 | workspace_root: None, | 524 | workspace_root: None, |
525 | cargo_prefix: config.cargo_prefix.clone(), | 525 | override_cargo: config.override_cargo.clone(), |
526 | cargo_args: vec!["check".to_string(), "--workspace".to_string()], | 526 | cargo_args: vec!["check".to_string(), "--workspace".to_string()], |
527 | cargo_extra_args: config.cargo_extra_args.clone(), | 527 | cargo_extra_args: config.cargo_extra_args.clone(), |
528 | executable_args: Vec::new(), | 528 | executable_args: Vec::new(), |
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index 72c4ebfd3..fee0bb69c 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -171,8 +171,8 @@ pub enum RunnableKind { | |||
171 | #[derive(Deserialize, Serialize, Debug)] | 171 | #[derive(Deserialize, Serialize, Debug)] |
172 | #[serde(rename_all = "camelCase")] | 172 | #[serde(rename_all = "camelCase")] |
173 | pub struct CargoRunnable { | 173 | pub struct CargoRunnable { |
174 | // stuff before `cargo` command, e.g. `RUST_LOG=info` | 174 | // command to be executed instead of cargo |
175 | pub cargo_prefix: Vec<String>, | 175 | pub override_cargo: Option<String>, |
176 | #[serde(skip_serializing_if = "Option::is_none")] | 176 | #[serde(skip_serializing_if = "Option::is_none")] |
177 | pub workspace_root: Option<PathBuf>, | 177 | pub workspace_root: Option<PathBuf>, |
178 | // command, --package and --lib stuff | 178 | // command, --package and --lib stuff |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 5dca520c3..aeacde0f7 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -755,7 +755,7 @@ pub(crate) fn runnable( | |||
755 | kind: lsp_ext::RunnableKind::Cargo, | 755 | kind: lsp_ext::RunnableKind::Cargo, |
756 | args: lsp_ext::CargoRunnable { | 756 | args: lsp_ext::CargoRunnable { |
757 | workspace_root: workspace_root.map(|it| it.into()), | 757 | workspace_root: workspace_root.map(|it| it.into()), |
758 | cargo_prefix: config.cargo_prefix.clone(), | 758 | override_cargo: config.override_cargo.clone(), |
759 | cargo_args, | 759 | cargo_args, |
760 | cargo_extra_args: config.cargo_extra_args.clone(), | 760 | cargo_extra_args: config.cargo_extra_args.clone(), |
761 | executable_args, | 761 | executable_args, |