mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Add **Copy Run Command Line** command for vscode
This is useful when you want to, e.g., run a specific test in a terminal with `--release`.
This commit is contained in:
parent
36465b34b3
commit
97166e2ad9
4 changed files with 31 additions and 8 deletions
|
@ -128,13 +128,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
|
|||
throw `Unexpected runnable kind: ${runnable.kind}`;
|
||||
}
|
||||
|
||||
const args = [...runnable.args.cargoArgs]; // should be a copy!
|
||||
if (runnable.args.cargoExtraArgs) {
|
||||
args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options.
|
||||
}
|
||||
if (runnable.args.executableArgs.length > 0) {
|
||||
args.push('--', ...runnable.args.executableArgs);
|
||||
}
|
||||
const args = createArgs(runnable);
|
||||
|
||||
const definition: tasks.CargoTaskDefinition = {
|
||||
type: tasks.TASK_TYPE,
|
||||
|
@ -151,3 +145,14 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
|
|||
|
||||
return cargoTask;
|
||||
}
|
||||
|
||||
export function createArgs(runnable: ra.Runnable): string[] {
|
||||
const args = [...runnable.args.cargoArgs]; // should be a copy!
|
||||
if (runnable.args.cargoExtraArgs) {
|
||||
args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options.
|
||||
}
|
||||
if (runnable.args.executableArgs.length > 0) {
|
||||
args.push('--', ...runnable.args.executableArgs);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue