Skip to content

Commit 1ddfa65

Browse files
committed
1 parent 841b784 commit 1ddfa65

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
303303
this._configurationResolverService.contributeVariable('defaultBuildTask', async (): Promise<string | undefined> => {
304304
let tasks = await this._getTasksForGroup(TaskGroup.Build);
305305
if (tasks.length > 0) {
306-
const { none, defaults } = this._splitPerGroupType(tasks);
306+
const defaults = this._getDefaultTasks(tasks);
307307
if (defaults.length === 1) {
308308
return defaults[0]._label;
309-
} else if (defaults.length + none.length > 0) {
310-
tasks = defaults.concat(none);
309+
} else if (defaults.length) {
310+
tasks = defaults;
311311
}
312312
}
313313

@@ -2875,24 +2875,21 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
28752875

28762876
/**
28772877
*
2878-
* @param tasks - The tasks which need filtering from defaults and non-defaults
2879-
* @param taskGlobsInList - This tells splitPerGroupType to filter out globbed tasks (into default), otherwise fall back to boolean
2878+
* @param tasks - The tasks which need to be filtered
2879+
* @param taskGlobsInList - This tells splitPerGroupType to filter out globbed tasks (into defaults)
28802880
* @returns
28812881
*/
2882-
private _splitPerGroupType(tasks: Task[], taskGlobsInList: boolean = false): { none: Task[]; defaults: Task[] } {
2883-
const none: Task[] = [];
2882+
private _getDefaultTasks(tasks: Task[], taskGlobsInList: boolean = false): Task[] {
28842883
const defaults: Task[] = [];
28852884
for (const task of tasks) {
28862885
// At this point (assuming taskGlobsInList is true) there are tasks with matching globs, so only put those in defaults
28872886
if (taskGlobsInList && typeof (task.configurationProperties.group as TaskGroup).isDefault === 'string') {
28882887
defaults.push(task);
28892888
} else if (!taskGlobsInList && (task.configurationProperties.group as TaskGroup).isDefault === true) {
28902889
defaults.push(task);
2891-
} else {
2892-
none.push(task);
28932890
}
28942891
}
2895-
return { none, defaults };
2892+
return defaults;
28962893
}
28972894

28982895
private _runTaskGroupCommand(taskGroup: TaskGroup, strings: {
@@ -2961,12 +2958,12 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
29612958
if (tasks.length > 0) {
29622959
// If we're dealing with tasks that were chosen because of a glob match,
29632960
// then put globs in the defaults and everything else in none
2964-
const { none, defaults } = this._splitPerGroupType(tasks, areGlobTasks);
2961+
const defaults = this._getDefaultTasks(tasks, areGlobTasks);
29652962
if (defaults.length === 1) {
29662963
runSingleTask(defaults[0], undefined, this);
29672964
return;
2968-
} else if (defaults.length + none.length > 0) {
2969-
tasks = defaults.concat(none);
2965+
} else if (defaults.length > 0) {
2966+
tasks = defaults;
29702967
}
29712968
}
29722969

@@ -2999,7 +2996,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
29992996

30002997
// If no globs are found or matched fallback to checking for default tasks of the task group
30012998
if (!taskGroupTasks.length) {
3002-
taskGroupTasks = await this._findWorkspaceTasksInGroup(taskGroup, false);
2999+
taskGroupTasks = await this._findWorkspaceTasksInGroup(taskGroup, true);
30033000
}
30043001

30053002
// A single default task was returned, just run it directly

0 commit comments

Comments
 (0)