Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/run.ts')
| -rw-r--r-- | editors/code/src/run.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index b6c730a4cd..02ccbb6956 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts @@ -2,6 +2,7 @@ import * as vscode from "vscode"; import type * as lc from "vscode-languageclient"; import * as ra from "./lsp_ext"; import * as tasks from "./tasks"; +import * as toolchain from "./toolchain"; import type { CtxInit } from "./ctx"; import { makeDebugConfig } from "./debug"; @@ -111,10 +112,21 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise throw `Unexpected runnable kind: ${runnable.kind}`; } - const args = createArgs(runnable); + let program: string; + let args = createArgs(runnable); + if (runnable.args.overrideCargo) { + // Split on spaces to allow overrides like "wrapper cargo". + const cargoParts = runnable.args.overrideCargo.split(" "); + + program = unwrapUndefinable(cargoParts[0]); + args = [...cargoParts.slice(1), ...args]; + } else { + program = await toolchain.cargoPath(); + } const definition: tasks.RustTargetDefinition = { type: tasks.TASK_TYPE, + program, args, cwd: runnable.args.workspaceRoot || ".", env: prepareEnv(runnable, config.runnablesExtraEnv), |