@@ -2783,10 +2783,11 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2783
2783
private _runTaskCommand ( arg ?: any ) : void {
2784
2784
const identifier = this . _getTaskIdentifier ( arg ) ;
2785
2785
const type = arg && typeof arg !== 'string' && 'type' in arg ? arg . type : undefined ;
2786
- const task = arg && typeof arg !== 'string' && 'task' in arg ? arg . task : arg === 'string' ? arg : undefined ;
2786
+ let task = arg && typeof arg !== 'string' && 'task' in arg ? arg . task : arg === 'string' ? arg : undefined ;
2787
2787
if ( identifier ) {
2788
2788
this . _getGroupedTasks ( { task, type } ) . then ( async ( grouped ) => {
2789
2789
const resolver = this . _createResolver ( grouped ) ;
2790
+ const tasks = grouped . all ( ) ;
2790
2791
const folderURIs : ( URI | string ) [ ] = this . _contextService . getWorkspace ( ) . folders . map ( folder => folder . uri ) ;
2791
2792
if ( this . _contextService . getWorkbenchState ( ) === WorkbenchState . WORKSPACE ) {
2792
2793
folderURIs . push ( this . _contextService . getWorkspace ( ) . configuration ! ) ;
@@ -2802,14 +2803,17 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
2802
2803
}
2803
2804
// match by label
2804
2805
if ( ! ! task ) {
2805
- const taskToRun = grouped . all ( ) . find ( g => g . _label === task ) ;
2806
+ const taskToRun = tasks . find ( g => g . _label === task ) ;
2806
2807
if ( taskToRun ) {
2807
2808
this . run ( taskToRun ) . then ( undefined , ( ) => { } ) ;
2808
2809
return ;
2809
2810
}
2810
2811
}
2812
+ if ( task && ! tasks . some ( g => g . _label . includes ( task ) ) ) {
2813
+ task = undefined ;
2814
+ }
2811
2815
// if task is defined, will be used as a filter
2812
- this . _doRunTaskCommand ( grouped . all ( ) , type , task ) ;
2816
+ this . _doRunTaskCommand ( tasks , type , task ) ;
2813
2817
} ) ;
2814
2818
}
2815
2819
this . _doRunTaskCommand ( ) ;
0 commit comments