aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/run.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/run.ts')
-rw-r--r--editors/code/src/run.ts21
1 files changed, 15 insertions, 6 deletions
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts
index 5fc4f8e41..5c790741f 100644
--- a/editors/code/src/run.ts
+++ b/editors/code/src/run.ts
@@ -103,18 +103,27 @@ interface CargoTaskDefinition extends vscode.TaskDefinition {
103 env?: { [key: string]: string }; 103 env?: { [key: string]: string };
104} 104}
105 105
106export function createTask(spec: ra.Runnable): vscode.Task { 106export function createTask(runnable: ra.Runnable): vscode.Task {
107 const TASK_SOURCE = 'Rust'; 107 const TASK_SOURCE = 'Rust';
108
109 let command;
110 switch (runnable.kind) {
111 case "cargo": command = toolchain.getPathForExecutable("cargo");
112 }
113 const args = runnable.args.cargoArgs;
114 if (runnable.args.executableArgs.length > 0) {
115 args.push('--', ...runnable.args.executableArgs);
116 }
108 const definition: CargoTaskDefinition = { 117 const definition: CargoTaskDefinition = {
109 type: 'cargo', 118 type: 'cargo',
110 label: spec.label, 119 label: runnable.label,
111 command: toolchain.getPathForExecutable(spec.kind), 120 command,
112 args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, 121 args,
113 env: Object.assign({}, process.env, spec.env), 122 env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }),
114 }; 123 };
115 124
116 const execOption: vscode.ShellExecutionOptions = { 125 const execOption: vscode.ShellExecutionOptions = {
117 cwd: spec.cwd || '.', 126 cwd: runnable.args.workspaceRoot || '.',
118 env: definition.env, 127 env: definition.env,
119 }; 128 };
120 const exec = new vscode.ShellExecution( 129 const exec = new vscode.ShellExecution(