Skip to content

Commit

Permalink
update workspace model on location change
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Grant <colin.grant@ericsson.com>
  • Loading branch information
Colin Grant committed Apr 12, 2021
1 parent b722e4d commit bd18043
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 3 additions & 0 deletions packages/task/src/browser/task-configuration-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export class TaskConfigurationManager {
this.workspaceService.onWorkspaceChanged(() => {
this.updateModels();
});
this.workspaceService.onWorkspaceLocationChanged(() => {
this.updateModels();
});
}

protected createModels(): void {
Expand Down
9 changes: 3 additions & 6 deletions packages/task/src/browser/task-configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,16 @@ export class TaskConfigurations implements Disposable {
}

getRawTaskConfigurations(scope?: TaskConfigurationScope): (TaskCustomization | TaskConfiguration)[] {
if (!scope) {
if (scope === undefined) {
const tasks: (TaskCustomization | TaskConfiguration)[] = [];
for (const configs of this.rawTaskConfigurations.values()) {
tasks.push(...configs);
}
return tasks;
}

const scopeKey = this.getKeyFromScope(scope);
if (this.rawTaskConfigurations.has(scopeKey)) {
return Array.from(this.rawTaskConfigurations.get(scopeKey)!.values());
}
return [];
const tasksInScope = this.rawTaskConfigurations.get(this.getKeyFromScope(scope)) ?? [];
return tasksInScope.slice();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/task/src/browser/task-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ export class TaskService implements TaskConfigurationClient {
}

/**
* Runs a task identified by the given identifier, but only if found in the give workspace folder
* Runs a task identified by the given identifier, but only if found in the given workspace folder
*
* @param token The cache token for the user interaction in progress
* @param workspaceFolderUri The folder to restrict the search to
Expand Down

0 comments on commit bd18043

Please sign in to comment.