Skip to content

Commit

Permalink
do not clear Task definition or scope unless execution changes
Browse files Browse the repository at this point in the history
- in the current Task class of the plugin-ext package, the "definition" and "scope" property are reset if any Task property gets updated. Since the "task definition" is only dependent on "task execution", this change updates the value of "task definition" if and only if "task execution" is changed.

Signed-off-by: elaihau <liang.huang@ericsson.com>
  • Loading branch information
elaihau committed Feb 11, 2019
1 parent 1e2cce9 commit 6bcd886
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,6 @@ export class Task {
if (value === undefined || value === null) {
throw illegalArgument('Kind can\'t be undefined or null');
}
this.clear();
this.taskDefinition = value;
}

Expand All @@ -1545,7 +1544,6 @@ export class Task {
}

set scope(value: theia.TaskScope.Global | theia.TaskScope.Workspace | theia.WorkspaceFolder | undefined) {
this.clear();
this.taskScope = value;
}

Expand All @@ -1557,7 +1555,6 @@ export class Task {
if (typeof value !== 'string') {
throw illegalArgument('name');
}
this.clear();
this.taskName = value;
}

Expand All @@ -1569,7 +1566,7 @@ export class Task {
if (value === null) {
value = undefined;
}
this.clear();
this.updateDefinitionBasedOnExecution();
this.taskExecution = value;
}

Expand All @@ -1583,7 +1580,6 @@ export class Task {
this.hasTaskProblemMatchers = false;
return;
}
this.clear();
this.taskProblemMatchers = value;
this.hasTaskProblemMatchers = true;
}
Expand All @@ -1600,7 +1596,6 @@ export class Task {
if (value !== true && value !== false) {
value = false;
}
this.clear();
this.isTaskBackground = value;
}

Expand All @@ -1612,7 +1607,6 @@ export class Task {
if (typeof value !== 'string' || value.length === 0) {
throw illegalArgument('source must be a string of length > 0');
}
this.clear();
this.taskSource = value;
}

Expand All @@ -1625,7 +1619,6 @@ export class Task {
this.taskGroup = undefined;
return;
}
this.clear();
this.taskGroup = value;
}

Expand All @@ -1637,12 +1630,10 @@ export class Task {
if (value === null) {
value = undefined;
}
this.clear();
this.taskPresentationOptions = value;
}

private clear(): void {
this.taskScope = undefined;
private updateDefinitionBasedOnExecution(): void {
this.taskDefinition = undefined;
if (this.taskExecution instanceof ProcessExecution) {
this.taskDefinition = {
Expand Down

0 comments on commit 6bcd886

Please sign in to comment.