From 94305d514d59a554a3b9f896e8dd3a6adaa28ab1 Mon Sep 17 00:00:00 2001 From: Vincent Fugnitto Date: Fri, 14 Jun 2019 08:18:36 -0400 Subject: [PATCH] Add the display of configured tasks when executing 'configure tasks...' Fixed #5468 Added `configured` tasks when executing the command and menu item for `configure tasks...`. Previously, only `provided` tasks were displayed which is inconsistent with vscode, and our own implementation present in the command `run task...` which permits configuring all tasks using the `configure` icon. In order to be consistent, and align with vscode and our own implementations, `configured` tasks should also be added to the menu. Triggering the `configure` for any given task opens the `task.json`. Signed-off-by: Vincent Fugnitto --- packages/task/src/browser/quick-open-task.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/task/src/browser/quick-open-task.ts b/packages/task/src/browser/quick-open-task.ts index e5eae470680d8..dfdbb4cc82713 100644 --- a/packages/task/src/browser/quick-open-task.ts +++ b/packages/task/src/browser/quick-open-task.ts @@ -173,15 +173,16 @@ export class QuickOpenTask implements QuickOpenModel, QuickOpenHandler { this.items = []; this.actionProvider = undefined; + const configuredTasks = await this.taskService.getConfiguredTasks(); const providedTasks = await this.taskService.getProvidedTasks(); - if (!providedTasks.length) { + if (!configuredTasks && !providedTasks.length) { this.items.push(new QuickOpenItem({ label: 'No tasks found', run: (_mode: QuickOpenMode): boolean => false })); } - providedTasks.forEach(task => { + [...configuredTasks, ...providedTasks].forEach(task => { this.items.push(new TaskConfigureQuickOpenItem(task, this.taskService, this.labelProvider)); }); @@ -312,6 +313,8 @@ export class TaskAttachQuickOpenItem extends QuickOpenItem { } export class TaskConfigureQuickOpenItem extends QuickOpenGroupItem { + protected taskDefinitionRegistry: TaskDefinitionRegistry; + constructor( protected readonly task: TaskConfiguration, protected readonly taskService: TaskService, @@ -321,7 +324,9 @@ export class TaskConfigureQuickOpenItem extends QuickOpenGroupItem { } getLabel(): string { - return `${this.task._source}: ${this.task.label}`; + return this.task._source + ? `${this.task._source}: ${this.task.label}` + : `${this.task.type}: ${this.task.label}`; } getDescription(): string {