提交 cb1813d0 编写于 作者: D Dirk Baeumer

Fix label generation for tasks in pickers

上级 1d79063f
......@@ -465,6 +465,15 @@ export namespace Task {
export function matches(task: Task, alias: string): boolean {
return alias === task._label || alias === task.identifier;
}
export function getQualifiedLabel(task: Task): string {
let workspaceFolder = getWorkspaceFolder(task);
if (workspaceFolder) {
return `${task._label} (${workspaceFolder.name})`;
} else {
return task._label;
}
}
}
......
......@@ -1350,9 +1350,9 @@ class TaskService extends EventEmitter implements ITaskService {
let active = executeResult.active;
if (active.same) {
if (active.background) {
this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame.background', 'The task \'{0}\' is already active and in background mode. To terminate it use `Terminate Task...` from the Tasks menu.', task._label));
this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame.background', 'The task \'{0}\' is already active and in background mode. To terminate it use `Terminate Task...` from the Tasks menu.', Task.getQualifiedLabel(task)));
} else {
this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame.noBackground', 'The task \'{0}\' is already active. To terminate it use `Terminate Task...` from the Tasks menu.', task._label));
this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame.noBackground', 'The task \'{0}\' is already active. To terminate it use `Terminate Task...` from the Tasks menu.', Task.getQualifiedLabel(task)));
}
} else {
throw new TaskError(Severity.Warning, nls.localize('TaskSystem.active', 'There is already a task running. Terminate it first before executing another task.'), TaskErrors.RunningTask);
......@@ -1949,10 +1949,11 @@ class TaskService extends EventEmitter implements ITaskService {
fillEntries(entries, detected, nls.localize('detected', 'detected tasks'), hasRecentlyUsed || hasConfigured);
}
} else {
entries = tasks.map<TaskQickPickEntry>(task => { return { label: task._label, task }; });
if (sort) {
entries = entries.sort((a, b) => a.task._label.localeCompare(b.task._label));
const sorter = this.createSorter();
tasks = tasks.sort((a, b) => sorter.compare(a, b));
}
entries = tasks.map<TaskQickPickEntry>(task => TaskQickPickEntry(task));
}
return this.quickOpenService.pick(entries, { placeHolder, autoFocus: { autoFocusFirstEntry: true } }).then(entry => entry ? entry.task : undefined);
}
......@@ -2148,7 +2149,7 @@ class TaskService extends EventEmitter implements ITaskService {
}
}
if (defaultTask) {
this.messageService.show(Severity.Info, nls.localize('TaskService.defaultBuildTaskExists', '{0} is already marked as the default build task.', defaultTask._label));
this.messageService.show(Severity.Info, nls.localize('TaskService.defaultBuildTaskExists', '{0} is already marked as the default build task.', Task.getQualifiedLabel(defaultTask)));
return;
}
this.showQuickPick(tasks, nls.localize('TaskService.pickDefaultBuildTask', 'Select the task to be used as the default build task'), true).then((task) => {
......@@ -2182,7 +2183,7 @@ class TaskService extends EventEmitter implements ITaskService {
}
}
if (defaultTask) {
this.messageService.show(Severity.Info, nls.localize('TaskService.defaultTestTaskExists', '{0} is already marked as the default test task.', defaultTask._label));
this.messageService.show(Severity.Info, nls.localize('TaskService.defaultTestTaskExists', '{0} is already marked as the default test task.', Task.getQualifiedLabel(defaultTask)));
return;
}
this.showQuickPick(tasks, nls.localize('TaskService.pickDefaultTestTask', 'Select the task to be used as the default test task'), true).then((task) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册