Skip to content

Commit

Permalink
Tasks: Ensure workspace delegate and scope exist
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-grant-work committed Jan 5, 2022
1 parent ff1121f commit 2ae9e6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/task/src/browser/task-configuration-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ export class TaskConfigurationManager {

protected readonly toDisposeOnDelegateChange = new DisposableCollection();
protected updateWorkspaceModel(): void {
const newDelegate = this.workspaceService.saved ? this.workspacePreferences : this.folderPreferences;
const effectiveScope = this.workspaceService.saved ? TaskScope.Workspace : this.workspaceService.tryGetRoots()[0]?.resource.toString();
const isFolderWorkspace = this.workspaceService.opened && !this.workspaceService.saved;
const newDelegate = isFolderWorkspace ? this.folderPreferences : this.workspacePreferences;
const effectiveScope = isFolderWorkspace ? this.workspaceService.tryGetRoots()[0]?.resource.toString() : TaskScope.Workspace;
if (newDelegate !== this.workspaceDelegate) {
this.workspaceDelegate = newDelegate;
this.toDisposeOnDelegateChange.dispose();
Expand Down
5 changes: 5 additions & 0 deletions packages/workspace/src/browser/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,11 @@ export class WorkspaceService implements FrontendApplicationContribution {
return false;
}

/**
* `true` if the current workspace is configured using a configuration file.
*
* `false` if there is no workspace or the workspace is simply a folder.
*/
get saved(): boolean {
return !!this._workspace && !this._workspace.isDirectory;
}
Expand Down

0 comments on commit 2ae9e6e

Please sign in to comment.