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 Jun 17, 2019
1 parent e6651fb commit 1d1c2b1
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/task/src/browser/quick-open-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,16 @@ export class QuickOpenTask implements QuickOpenModel, QuickOpenHandler {
this.items = [];
this.actionProvider = undefined;

const configuredTasks = 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 @@ -311,14 +312,21 @@ export class TaskConfigureQuickOpenItem extends QuickOpenGroupItem {
}

getLabel(): string {
return `${this.task._source}: ${this.task.label}`;
if (ContributedTaskConfiguration.is(this.task)) {
return `${this.task._source}: ${this.task.label}`;
}
return `${this.task.type}: ${this.task.label}`;
}

getDescription(): string {
if (this.task._scope) {
return this.labelProvider.getLongName(new URI(this.task._scope));
if (ContributedTaskConfiguration.is(this.task)) {
if (this.task._scope) {
return this.labelProvider.getLongName(new URI(this.task._scope));
}
return this.task._source;
} else {
return new URI(this.task._source).displayName;
}
return this.task._source;
}

run(mode: QuickOpenMode): boolean {
Expand Down

0 comments on commit 1d1c2b1

Please sign in to comment.