diff options
author | Igor Aleksanov <[email protected]> | 2020-09-05 14:21:14 +0100 |
---|---|---|
committer | Igor Aleksanov <[email protected]> | 2020-10-02 10:35:22 +0100 |
commit | 5b26629a4d8ca388db1b272a7c8b8ea37f45c9f9 (patch) | |
tree | 6d056f5658df00cff3c4acadf73d80f7d832d915 /editors/code/src/tasks.ts | |
parent | 4a1b4b23bb58398a7e2a955e0be43ff2c09fe9e5 (diff) |
Support 'runnables' options in the vs code extension
Diffstat (limited to 'editors/code/src/tasks.ts')
-rw-r--r-- | editors/code/src/tasks.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/code/src/tasks.ts b/editors/code/src/tasks.ts index 14abbd5b7..a3ff15102 100644 --- a/editors/code/src/tasks.ts +++ b/editors/code/src/tasks.ts | |||
@@ -13,6 +13,7 @@ export interface CargoTaskDefinition extends vscode.TaskDefinition { | |||
13 | args?: string[]; | 13 | args?: string[]; |
14 | cwd?: string; | 14 | cwd?: string; |
15 | env?: { [key: string]: string }; | 15 | env?: { [key: string]: string }; |
16 | overrideCargo?: string; | ||
16 | } | 17 | } |
17 | 18 | ||
18 | class CargoTaskProvider implements vscode.TaskProvider { | 19 | class CargoTaskProvider implements vscode.TaskProvider { |
@@ -98,7 +99,14 @@ export async function buildCargoTask( | |||
98 | } | 99 | } |
99 | 100 | ||
100 | if (!exec) { | 101 | if (!exec) { |
101 | exec = new vscode.ShellExecution(toolchain.cargoPath(), args, definition); | 102 | // Check whether we must use a user-defined substitute for cargo. |
103 | const cargoCommand = definition.overrideCargo ? definition.overrideCargo : toolchain.cargoPath(); | ||
104 | |||
105 | // Prepare the whole command as one line. It is required if user has provided override command which contains spaces, | ||
106 | // for example "wrapper cargo". Without manual preparation the overridden command will be quoted and fail to execute. | ||
107 | const fullCommand = [cargoCommand, ...args].join(" "); | ||
108 | |||
109 | exec = new vscode.ShellExecution(fullCommand, definition); | ||
102 | } | 110 | } |
103 | 111 | ||
104 | return new vscode.Task( | 112 | return new vscode.Task( |