Unnamed repository; edit this file 'description' to name the repository.
Fix RunnableKind::Run label interpolation
It was pretty useless without this.
Previously:
Parsing target pattern `{label}`
Caused by:
Invalid target name `{label}`. (...)
Build ID: 6dab5942-d81c-4430-83b0-5ba523999050
Network: Up: 0B Down: 0B
Command: run.
Time elapsed: 0.3s
BUILD FAILED
* The terminal process "buck2 'run', '{label}'" terminated with exit code: 3.
| -rw-r--r-- | crates/rust-analyzer/src/target_spec.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/target_spec.rs b/crates/rust-analyzer/src/target_spec.rs index 8452b6493e..b8d9acc02a 100644 --- a/crates/rust-analyzer/src/target_spec.rs +++ b/crates/rust-analyzer/src/target_spec.rs @@ -77,7 +77,16 @@ impl ProjectJsonTargetSpec { RunnableKind::Bin => { for runnable in &self.shell_runnables { if matches!(runnable.kind, project_model::project_json::RunnableKind::Run) { - return Some(runnable.clone()); + let mut runnable = runnable.clone(); + + let replaced_args: Vec<_> = runnable + .args + .iter() + .map(|arg| arg.replace("{label}", &self.label)) + .collect(); + runnable.args = replaced_args; + + return Some(runnable); } } |