Merge pull request #209477 from microsoft/merogge/default-task

fix build task command issues
This commit is contained in:
Megan Rogge 2024-04-03 14:33:49 -07:00 committed by GitHub
commit f756507655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2948,7 +2948,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
*/
private _getDefaultTasks(tasks: Task[], taskGlobsInList: boolean = false): Task[] {
const defaults: Task[] = [];
for (const task of tasks) {
for (const task of tasks.filter(t => !!t.configurationProperties.group)) {
// At this point (assuming taskGlobsInList is true) there are tasks with matching globs, so only put those in defaults
if (taskGlobsInList && typeof (task.configurationProperties.group as TaskGroup).isDefault === 'string') {
defaults.push(task);
@ -3050,16 +3050,21 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
// If no globs are found or matched fallback to checking for default tasks of the task group
if (!groupTasks.length) {
groupTasks = await this._findWorkspaceTasksInGroup(taskGroup, false);
groupTasks = await this._findWorkspaceTasksInGroup(taskGroup, true);
}
// A single default task was returned, just run it directly
if (groupTasks.length === 1) {
return resolveTaskAndRun(groupTasks[0]);
switch (groupTasks.length) {
case 0:
// No tasks found, prompt to configure
configure.apply(this);
break;
case 1:
// A single default task was returned, just run it directly
return resolveTaskAndRun(groupTasks[0]);
default:
// Multiple default tasks returned, show the quickPicker
return handleMultipleTasks(false);
}
// Multiple default tasks returned, show the quickPicker
return handleMultipleTasks(false);
})();
this._progressService.withProgress(options, () => promise);
}