diff --git a/packages/task/src/browser/task-configuration-manager.ts b/packages/task/src/browser/task-configuration-manager.ts index 6f1ba795aa0fc..58b0f06669351 100644 --- a/packages/task/src/browser/task-configuration-manager.ts +++ b/packages/task/src/browser/task-configuration-manager.ts @@ -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(); diff --git a/packages/workspace/src/browser/workspace-service.ts b/packages/workspace/src/browser/workspace-service.ts index 4214c6b560223..47dcee22b612c 100644 --- a/packages/workspace/src/browser/workspace-service.ts +++ b/packages/workspace/src/browser/workspace-service.ts @@ -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; }