mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Support 'runnables' options in the vs code extension
This commit is contained in:
parent
4a1b4b23bb
commit
5b26629a4d
5 changed files with 31 additions and 2 deletions
|
@ -13,6 +13,7 @@ export interface CargoTaskDefinition extends vscode.TaskDefinition {
|
|||
args?: string[];
|
||||
cwd?: string;
|
||||
env?: { [key: string]: string };
|
||||
overrideCargo?: string;
|
||||
}
|
||||
|
||||
class CargoTaskProvider implements vscode.TaskProvider {
|
||||
|
@ -98,7 +99,14 @@ export async function buildCargoTask(
|
|||
}
|
||||
|
||||
if (!exec) {
|
||||
exec = new vscode.ShellExecution(toolchain.cargoPath(), args, definition);
|
||||
// Check whether we must use a user-defined substitute for cargo.
|
||||
const cargoCommand = definition.overrideCargo ? definition.overrideCargo : toolchain.cargoPath();
|
||||
|
||||
// Prepare the whole command as one line. It is required if user has provided override command which contains spaces,
|
||||
// for example "wrapper cargo". Without manual preparation the overridden command will be quoted and fail to execute.
|
||||
const fullCommand = [cargoCommand, ...args].join(" ");
|
||||
|
||||
exec = new vscode.ShellExecution(fullCommand, definition);
|
||||
}
|
||||
|
||||
return new vscode.Task(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue