Skip to content

Commit 4a1b4b2

Browse files
committed
Replace 'cargo_prefix' option with 'override_cargo'
1 parent 2c125f3 commit 4a1b4b2

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ pub enum RustfmtConfig {
128128
/// Configuration for runnable items, such as `main` function or tests.
129129
#[derive(Debug, Clone, Default)]
130130
pub struct RunnablesConfig {
131-
/// Stuff to be inserted before `cargo`, e.g. `RUST_LOG=info`.
132-
pub cargo_prefix: Vec<String>,
131+
/// Custom command to be executed instead of `cargo` for runnables.
132+
pub override_cargo: Option<String>,
133133
/// Additional arguments for the `cargo`, e.g. `--release`.
134134
pub cargo_extra_args: Vec<String>,
135135
}
@@ -232,7 +232,7 @@ impl Config {
232232
target: data.cargo_target.clone(),
233233
};
234234
self.runnables = RunnablesConfig {
235-
cargo_prefix: data.runnables_cargoPrefix,
235+
override_cargo: data.runnables_overrideCargo,
236236
cargo_extra_args: data.runnables_cargoExtraArgs,
237237
};
238238

@@ -489,8 +489,8 @@ config_data! {
489489
notifications_cargoTomlNotFound: bool = true,
490490
procMacro_enable: bool = false,
491491

492-
runnables_cargoPrefix: Vec<String> = Vec::new(),
493-
runnables_cargoExtraArgs: Vec<String> = Vec::new(),
492+
runnables_overrideCargo: Option<String> = None,
493+
runnables_cargoExtraArgs: Vec<String> = Vec::new(),
494494

495495
rustfmt_extraArgs: Vec<String> = Vec::new(),
496496
rustfmt_overrideCommand: Option<Vec<String>> = None,

crates/rust-analyzer/src/handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ pub(crate) fn handle_runnables(
501501
kind: lsp_ext::RunnableKind::Cargo,
502502
args: lsp_ext::CargoRunnable {
503503
workspace_root: Some(spec.workspace_root.clone().into()),
504-
cargo_prefix: config.cargo_prefix.clone(),
504+
override_cargo: config.override_cargo.clone(),
505505
cargo_args: vec![
506506
cmd.to_string(),
507507
"--package".to_string(),
@@ -522,7 +522,7 @@ pub(crate) fn handle_runnables(
522522
kind: lsp_ext::RunnableKind::Cargo,
523523
args: lsp_ext::CargoRunnable {
524524
workspace_root: None,
525-
cargo_prefix: config.cargo_prefix.clone(),
525+
override_cargo: config.override_cargo.clone(),
526526
cargo_args: vec!["check".to_string(), "--workspace".to_string()],
527527
cargo_extra_args: config.cargo_extra_args.clone(),
528528
executable_args: Vec::new(),

crates/rust-analyzer/src/lsp_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ pub enum RunnableKind {
171171
#[derive(Deserialize, Serialize, Debug)]
172172
#[serde(rename_all = "camelCase")]
173173
pub struct CargoRunnable {
174-
// stuff before `cargo` command, e.g. `RUST_LOG=info`
175-
pub cargo_prefix: Vec<String>,
174+
// command to be executed instead of cargo
175+
pub override_cargo: Option<String>,
176176
#[serde(skip_serializing_if = "Option::is_none")]
177177
pub workspace_root: Option<PathBuf>,
178178
// command, --package and --lib stuff

crates/rust-analyzer/src/to_proto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ pub(crate) fn runnable(
755755
kind: lsp_ext::RunnableKind::Cargo,
756756
args: lsp_ext::CargoRunnable {
757757
workspace_root: workspace_root.map(|it| it.into()),
758-
cargo_prefix: config.cargo_prefix.clone(),
758+
override_cargo: config.override_cargo.clone(),
759759
cargo_args,
760760
cargo_extra_args: config.cargo_extra_args.clone(),
761761
executable_args,

0 commit comments

Comments
 (0)