From 4a1b4b23bb58398a7e2a955e0be43ff2c09fe9e5 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sat, 5 Sep 2020 16:20:33 +0300 Subject: Replace 'cargo_prefix' option with 'override_cargo' --- crates/rust-analyzer/src/config.rs | 10 +++++----- crates/rust-analyzer/src/handlers.rs | 4 ++-- crates/rust-analyzer/src/lsp_ext.rs | 4 ++-- crates/rust-analyzer/src/to_proto.rs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'crates') 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 { /// Configuration for runnable items, such as `main` function or tests. #[derive(Debug, Clone, Default)] pub struct RunnablesConfig { - /// Stuff to be inserted before `cargo`, e.g. `RUST_LOG=info`. - pub cargo_prefix: Vec, + /// Custom command to be executed instead of `cargo` for runnables. + pub override_cargo: Option, /// Additional arguments for the `cargo`, e.g. `--release`. pub cargo_extra_args: Vec, } @@ -232,7 +232,7 @@ impl Config { target: data.cargo_target.clone(), }; self.runnables = RunnablesConfig { - cargo_prefix: data.runnables_cargoPrefix, + override_cargo: data.runnables_overrideCargo, cargo_extra_args: data.runnables_cargoExtraArgs, }; @@ -489,8 +489,8 @@ config_data! { notifications_cargoTomlNotFound: bool = true, procMacro_enable: bool = false, - runnables_cargoPrefix: Vec = Vec::new(), - runnables_cargoExtraArgs: Vec = Vec::new(), + runnables_overrideCargo: Option = None, + runnables_cargoExtraArgs: Vec = Vec::new(), rustfmt_extraArgs: Vec = Vec::new(), rustfmt_overrideCommand: Option> = 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( kind: lsp_ext::RunnableKind::Cargo, args: lsp_ext::CargoRunnable { workspace_root: Some(spec.workspace_root.clone().into()), - cargo_prefix: config.cargo_prefix.clone(), + override_cargo: config.override_cargo.clone(), cargo_args: vec![ cmd.to_string(), "--package".to_string(), @@ -522,7 +522,7 @@ pub(crate) fn handle_runnables( kind: lsp_ext::RunnableKind::Cargo, args: lsp_ext::CargoRunnable { workspace_root: None, - cargo_prefix: config.cargo_prefix.clone(), + override_cargo: config.override_cargo.clone(), cargo_args: vec!["check".to_string(), "--workspace".to_string()], cargo_extra_args: config.cargo_extra_args.clone(), 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 { #[derive(Deserialize, Serialize, Debug)] #[serde(rename_all = "camelCase")] pub struct CargoRunnable { - // stuff before `cargo` command, e.g. `RUST_LOG=info` - pub cargo_prefix: Vec, + // command to be executed instead of cargo + pub override_cargo: Option, #[serde(skip_serializing_if = "Option::is_none")] pub workspace_root: Option, // 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( kind: lsp_ext::RunnableKind::Cargo, args: lsp_ext::CargoRunnable { workspace_root: workspace_root.map(|it| it.into()), - cargo_prefix: config.cargo_prefix.clone(), + override_cargo: config.override_cargo.clone(), cargo_args, cargo_extra_args: config.cargo_extra_args.clone(), executable_args, -- cgit v1.2.3