mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
refactor: Store the CLI command directly in RustTargetDefinition
This commit is contained in:
parent
2e109c7da8
commit
4422a90b11
2 changed files with 18 additions and 14 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue