Skip to content

Commit

Permalink
rename TaskConfigurations.isConfiguredTask to isDetectedTask
Browse files Browse the repository at this point in the history
- isConfiguredTask is the wrong name, because a task should be a detected task if its definition is contributed by an extension or plugin

Signed-off-by: Liang Huang <liang.huang@ericsson.com>
  • Loading branch information
Liang Huang authored and elaihau committed Jul 12, 2019
1 parent 12f8ad2 commit 60dcb33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/task/src/browser/task-configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class TaskConfigurations implements Disposable {
const customizations: TaskCustomization[] = [];

tasksArray.forEach(t => {
if (this.isConfiguredTask(t)) {
if (this.isDetectedTask(t)) {
customizations.push(t);
} else {
configuredTasksArray.push(t);
Expand Down Expand Up @@ -314,7 +314,7 @@ export class TaskConfigurations implements Disposable {
protected filterDuplicates(tasks: TaskConfiguration[]): TaskConfiguration[] {
const filteredTasks: TaskConfiguration[] = [];
for (const task of tasks) {
if (filteredTasks.some(t => !this.isConfiguredTask(t) && t.label === task.label)) {
if (filteredTasks.some(t => !this.isDetectedTask(t) && t.label === task.label)) {
// TODO: create a problem marker so that this issue will be visible in the editor?
console.error(`Error parsing ${this.TASKFILE}: found duplicate entry for label: ${task.label}`);
} else {
Expand All @@ -328,7 +328,8 @@ export class TaskConfigurations implements Disposable {
return new URI(configFileUri).parent.parent.path.toString();
}

private isConfiguredTask(task: TaskConfiguration): task is ContributedTaskConfiguration {
/** checks if the config is a detected / contributed task */
private isDetectedTask(task: TaskConfiguration): task is ContributedTaskConfiguration {
const taskDefinition = this.taskDefinitionRegistry.getDefinition(task);
// it is considered as a customization if the task definition registry finds a def for the task configuration
return !!taskDefinition;
Expand Down

0 comments on commit 60dcb33

Please sign in to comment.