Skip to content

Commit

Permalink
Add the display of configured tasks when executing 'configure tasks...'
Browse files Browse the repository at this point in the history
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 <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Aug 6, 2019
1 parent bd04424 commit 94305d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/task/src/browser/quick-open-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});

Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down

0 comments on commit 94305d5

Please sign in to comment.