Replace 'cargo_prefix' option with 'override_cargo'

This commit is contained in:
Igor Aleksanov 2020-09-05 16:20:33 +03:00
parent 2c125f3c63
commit 4a1b4b23bb
4 changed files with 10 additions and 10 deletions

View File

@ -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<String>,
/// Custom command to be executed instead of `cargo` for runnables.
pub override_cargo: Option<String>,
/// Additional arguments for the `cargo`, e.g. `--release`.
pub cargo_extra_args: Vec<String>,
}
@ -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<String> = Vec::new(),
runnables_cargoExtraArgs: Vec<String> = Vec::new(),
runnables_overrideCargo: Option<String> = None,
runnables_cargoExtraArgs: Vec<String> = Vec::new(),
rustfmt_extraArgs: Vec<String> = Vec::new(),
rustfmt_overrideCommand: Option<Vec<String>> = None,

View File

@ -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(),

View File

@ -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<String>,
// command to be executed instead of cargo
pub override_cargo: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub workspace_root: Option<PathBuf>,
// command, --package and --lib stuff

View File

@ -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,