@@ -10,8 +10,7 @@ export const TASK_TYPE = "cargo";
1010export const TASK_SOURCE = "rust" ;
1111
1212export interface RustTargetDefinition extends vscode . TaskDefinition {
13- command ?: string ;
14- args ?: string [ ] ;
13+ args : string [ ] ;
1514 cwd ?: string ;
1615 env ?: { [ key : string ] : string } ;
1716 overrideCargo ?: string ;
@@ -44,9 +43,8 @@ class RustTaskProvider implements vscode.TaskProvider {
4443 for ( const def of defs ) {
4544 const vscodeTask = await buildRustTask (
4645 workspaceTarget ,
47- { type : TASK_TYPE , command : def . command } ,
46+ { type : TASK_TYPE , args : [ def . command ] } ,
4847 `cargo ${ def . command } ` ,
49- [ def . command ] ,
5048 this . config . problemMatcher ,
5149 this . config . cargoRunner ,
5250 ) ;
@@ -65,13 +63,11 @@ class RustTaskProvider implements vscode.TaskProvider {
6563
6664 const definition = task . definition as RustTargetDefinition ;
6765
68- if ( definition . type === TASK_TYPE && definition . command ) {
69- const args = [ definition . command ] . concat ( definition . args ?? [ ] ) ;
66+ if ( definition . type === TASK_TYPE ) {
7067 return await buildRustTask (
7168 task . scope ,
7269 definition ,
7370 task . name ,
74- args ,
7571 this . config . problemMatcher ,
7672 this . config . cargoRunner ,
7773 ) ;
@@ -85,7 +81,6 @@ export async function buildRustTask(
8581 scope : vscode . WorkspaceFolder | vscode . TaskScope | undefined ,
8682 definition : RustTargetDefinition ,
8783 name : string ,
88- args : string [ ] ,
8984 problemMatcher : string [ ] ,
9085 customRunner ?: string ,
9186 throwOnError : boolean = false ,
@@ -95,7 +90,12 @@ export async function buildRustTask(
9590 if ( customRunner ) {
9691 const runnerCommand = `${ customRunner } .buildShellExecution` ;
9792 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+ } ;
9999 const customExec = await vscode . commands . executeCommand ( runnerCommand , runnerArgs ) ;
100100 if ( customExec ) {
101101 if ( customExec instanceof vscode . ShellExecution ) {
@@ -119,7 +119,7 @@ export async function buildRustTask(
119119 const cargoPath = await toolchain . cargoPath ( ) ;
120120 const cargoCommand = overrideCargo ?. split ( " " ) ?? [ cargoPath ] ;
121121
122- const fullCommand = [ ...cargoCommand , ...args ] ;
122+ const fullCommand = [ ...cargoCommand , ...definition . args ] ;
123123
124124 const processName = unwrapUndefinable ( fullCommand [ 0 ] ) ;
125125 exec = new vscode . ProcessExecution ( processName , fullCommand . slice ( 1 ) , definition ) ;
0 commit comments