提交 1ccd9a76 编写于 作者: A Alex Ross

Don't fetch all tasks when there's a default build task

Fixes #95507
上级 5ccb199a
......@@ -2515,38 +2515,58 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
location: ProgressLocation.Window,
title: nls.localize('TaskService.fetchingBuildTasks', 'Fetching build tasks...')
};
let promise = this.getTasksForGroup(TaskGroup.Build).then((tasks) => {
if (tasks.length > 0) {
let { defaults, users } = this.splitPerGroupType(tasks);
if (defaults.length === 1) {
this.run(defaults[0]).then(undefined, reason => {
let promise = this.getWorkspaceTasks().then(tasks => {
const buildTasks: ConfiguringTask[] = [];
for (const taskSource of tasks) {
for (const task in taskSource[1].configurations?.byIdentifier) {
if ((taskSource[1].configurations?.byIdentifier[task].configurationProperties.group === TaskGroup.Build) &&
(taskSource[1].configurations?.byIdentifier[task].configurationProperties.groupType === GroupType.default)) {
buildTasks.push(taskSource[1].configurations.byIdentifier[task]);
}
}
}
if (buildTasks.length === 1) {
this.tryResolveTask(buildTasks[0]).then(resolvedTask => {
this.run(resolvedTask).then(undefined, reason => {
// eat the error, it has already been surfaced to the user and we don't care about it here
});
return;
} else if (defaults.length + users.length > 0) {
tasks = defaults.concat(users);
}
});
return;
}
this.showIgnoredFoldersMessage().then(() => {
this.showQuickPick(tasks,
nls.localize('TaskService.pickBuildTask', 'Select the build task to run'),
{
label: nls.localize('TaskService.noBuildTask', 'No build task to run found. Configure Build Task...'),
task: null
},
true).then((entry) => {
let task: Task | undefined | null = entry ? entry.task : undefined;
if (task === undefined) {
return;
}
if (task === null) {
this.runConfigureDefaultBuildTask();
return;
}
this.run(task, { attachProblemMatcher: true }).then(undefined, reason => {
return this.getTasksForGroup(TaskGroup.Build).then((tasks) => {
if (tasks.length > 0) {
let { defaults, users } = this.splitPerGroupType(tasks);
if (defaults.length === 1) {
this.run(defaults[0]).then(undefined, reason => {
// eat the error, it has already been surfaced to the user and we don't care about it here
});
});
return;
} else if (defaults.length + users.length > 0) {
tasks = defaults.concat(users);
}
}
this.showIgnoredFoldersMessage().then(() => {
this.showQuickPick(tasks,
nls.localize('TaskService.pickBuildTask', 'Select the build task to run'),
{
label: nls.localize('TaskService.noBuildTask', 'No build task to run found. Configure Build Task...'),
task: null
},
true).then((entry) => {
let task: Task | undefined | null = entry ? entry.task : undefined;
if (task === undefined) {
return;
}
if (task === null) {
this.runConfigureDefaultBuildTask();
return;
}
this.run(task, { attachProblemMatcher: true }).then(undefined, reason => {
// eat the error, it has already been surfaced to the user and we don't care about it here
});
});
});
});
});
this.progressService.withProgress(options, () => promise);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册