@@ -10,8 +10,7 @@ export const TASK_TYPE = "cargo";
10
10
export const TASK_SOURCE = "rust" ;
11
11
12
12
export interface RustTargetDefinition extends vscode . TaskDefinition {
13
- command ?: string ;
14
- args ?: string [ ] ;
13
+ args : string [ ] ;
15
14
cwd ?: string ;
16
15
env ?: { [ key : string ] : string } ;
17
16
overrideCargo ?: string ;
@@ -44,9 +43,8 @@ class RustTaskProvider implements vscode.TaskProvider {
44
43
for ( const def of defs ) {
45
44
const vscodeTask = await buildRustTask (
46
45
workspaceTarget ,
47
- { type : TASK_TYPE , command : def . command } ,
46
+ { type : TASK_TYPE , args : [ def . command ] } ,
48
47
`cargo ${ def . command } ` ,
49
- [ def . command ] ,
50
48
this . config . problemMatcher ,
51
49
this . config . cargoRunner ,
52
50
) ;
@@ -65,13 +63,11 @@ class RustTaskProvider implements vscode.TaskProvider {
65
63
66
64
const definition = task . definition as RustTargetDefinition ;
67
65
68
- if ( definition . type === TASK_TYPE && definition . command ) {
69
- const args = [ definition . command ] . concat ( definition . args ?? [ ] ) ;
66
+ if ( definition . type === TASK_TYPE ) {
70
67
return await buildRustTask (
71
68
task . scope ,
72
69
definition ,
73
70
task . name ,
74
- args ,
75
71
this . config . problemMatcher ,
76
72
this . config . cargoRunner ,
77
73
) ;
@@ -85,7 +81,6 @@ export async function buildRustTask(
85
81
scope : vscode . WorkspaceFolder | vscode . TaskScope | undefined ,
86
82
definition : RustTargetDefinition ,
87
83
name : string ,
88
- args : string [ ] ,
89
84
problemMatcher : string [ ] ,
90
85
customRunner ?: string ,
91
86
throwOnError : boolean = false ,
@@ -95,7 +90,12 @@ export async function buildRustTask(
95
90
if ( customRunner ) {
96
91
const runnerCommand = `${ customRunner } .buildShellExecution` ;
97
92
try {
98
- const runnerArgs = { kind : TASK_TYPE , args, cwd : definition . cwd , env : definition . env } ;
93
+ const runnerArgs = {
94
+ kind : TASK_TYPE ,
95
+ args : definition . args ,
96
+ cwd : definition . cwd ,
97
+ env : definition . env ,
98
+ } ;
99
99
const customExec = await vscode . commands . executeCommand ( runnerCommand , runnerArgs ) ;
100
100
if ( customExec ) {
101
101
if ( customExec instanceof vscode . ShellExecution ) {
@@ -119,7 +119,7 @@ export async function buildRustTask(
119
119
const cargoPath = await toolchain . cargoPath ( ) ;
120
120
const cargoCommand = overrideCargo ?. split ( " " ) ?? [ cargoPath ] ;
121
121
122
- const fullCommand = [ ...cargoCommand , ...args ] ;
122
+ const fullCommand = [ ...cargoCommand , ...definition . args ] ;
123
123
124
124
const processName = unwrapUndefinable ( fullCommand [ 0 ] ) ;
125
125
exec = new vscode . ProcessExecution ( processName , fullCommand . slice ( 1 ) , definition ) ;
0 commit comments