aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/lsp_ext.ts2
-rw-r--r--editors/code/src/run.ts2
-rw-r--r--editors/code/src/tasks.ts10
3 files changed, 13 insertions, 1 deletions
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
index eb422d3e7..f286b68a6 100644
--- a/editors/code/src/lsp_ext.ts
+++ b/editors/code/src/lsp_ext.ts
@@ -69,8 +69,10 @@ export interface Runnable {
69 args: { 69 args: {
70 workspaceRoot?: string; 70 workspaceRoot?: string;
71 cargoArgs: string[]; 71 cargoArgs: string[];
72 cargoExtraArgs: string[];
72 executableArgs: string[]; 73 executableArgs: string[];
73 expectTest?: boolean; 74 expectTest?: boolean;
75 overrideCargo?: string;
74 }; 76 };
75} 77}
76export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); 78export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables");
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts
index de68f27ae..459b7f250 100644
--- a/editors/code/src/run.ts
+++ b/editors/code/src/run.ts
@@ -129,6 +129,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
129 } 129 }
130 130
131 const args = [...runnable.args.cargoArgs]; // should be a copy! 131 const args = [...runnable.args.cargoArgs]; // should be a copy!
132 args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options.
132 if (runnable.args.executableArgs.length > 0) { 133 if (runnable.args.executableArgs.length > 0) {
133 args.push('--', ...runnable.args.executableArgs); 134 args.push('--', ...runnable.args.executableArgs);
134 } 135 }
@@ -139,6 +140,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
139 args: args.slice(1), 140 args: args.slice(1),
140 cwd: runnable.args.workspaceRoot || ".", 141 cwd: runnable.args.workspaceRoot || ".",
141 env: prepareEnv(runnable, config.runnableEnv), 142 env: prepareEnv(runnable, config.runnableEnv),
143 overrideCargo: runnable.args.overrideCargo,
142 }; 144 };
143 145
144 const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() 146 const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate()
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
18class CargoTaskProvider implements vscode.TaskProvider { 19class 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(