Skip to content

Commit edcee9b

Browse files
authored
discard filter and show all tasks when no matches are found (microsoft#160552)
fix 159901
1 parent 42238bd commit edcee9b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,10 +2783,11 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
27832783
private _runTaskCommand(arg?: any): void {
27842784
const identifier = this._getTaskIdentifier(arg);
27852785
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;
27872787
if (identifier) {
27882788
this._getGroupedTasks({ task, type }).then(async (grouped) => {
27892789
const resolver = this._createResolver(grouped);
2790+
const tasks = grouped.all();
27902791
const folderURIs: (URI | string)[] = this._contextService.getWorkspace().folders.map(folder => folder.uri);
27912792
if (this._contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
27922793
folderURIs.push(this._contextService.getWorkspace().configuration!);
@@ -2802,14 +2803,17 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
28022803
}
28032804
// match by label
28042805
if (!!task) {
2805-
const taskToRun = grouped.all().find(g => g._label === task);
2806+
const taskToRun = tasks.find(g => g._label === task);
28062807
if (taskToRun) {
28072808
this.run(taskToRun).then(undefined, () => { });
28082809
return;
28092810
}
28102811
}
2812+
if (task && !tasks.some(g => g._label.includes(task))) {
2813+
task = undefined;
2814+
}
28112815
// if task is defined, will be used as a filter
2812-
this._doRunTaskCommand(grouped.all(), type, task);
2816+
this._doRunTaskCommand(tasks, type, task);
28132817
});
28142818
}
28152819
this._doRunTaskCommand();

0 commit comments

Comments
 (0)