提交 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 ...@@ -2515,38 +2515,58 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
location: ProgressLocation.Window, location: ProgressLocation.Window,
title: nls.localize('TaskService.fetchingBuildTasks', 'Fetching build tasks...') title: nls.localize('TaskService.fetchingBuildTasks', 'Fetching build tasks...')
}; };
let promise = this.getTasksForGroup(TaskGroup.Build).then((tasks) => { let promise = this.getWorkspaceTasks().then(tasks => {
if (tasks.length > 0) { const buildTasks: ConfiguringTask[] = [];
let { defaults, users } = this.splitPerGroupType(tasks); for (const taskSource of tasks) {
if (defaults.length === 1) { for (const task in taskSource[1].configurations?.byIdentifier) {
this.run(defaults[0]).then(undefined, reason => { 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 // 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) { return;
tasks = defaults.concat(users);
}
} }
this.showIgnoredFoldersMessage().then(() => {
this.showQuickPick(tasks, return this.getTasksForGroup(TaskGroup.Build).then((tasks) => {
nls.localize('TaskService.pickBuildTask', 'Select the build task to run'), if (tasks.length > 0) {
{ let { defaults, users } = this.splitPerGroupType(tasks);
label: nls.localize('TaskService.noBuildTask', 'No build task to run found. Configure Build Task...'), if (defaults.length === 1) {
task: null this.run(defaults[0]).then(undefined, reason => {
},
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 // 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); this.progressService.withProgress(options, () => promise);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册