From fbeadf8c63f4a402d9c7cada41d79cab1b55e940 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 30 Sep 2020 12:17:32 +0200 Subject: [PATCH] Fallback to first remote task info when no folder is open Previous behavior was to fallback to local. It makes more sense to fallback to the the first remote details instead Related to https://github.com/microsoft/vscode-docker/issues/2350 --- .../contrib/tasks/browser/abstractTaskService.ts | 9 ++++++--- .../contrib/tasks/browser/terminalTaskSystem.ts | 2 +- src/vs/workbench/contrib/tasks/common/taskSystem.ts | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts index 7b7ba3dde69..c211f46c15a 100644 --- a/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts +++ b/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts @@ -1586,11 +1586,14 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer this.contextService, this.environmentService, AbstractTaskService.OutputChannelId, this.fileService, this.terminalInstanceService, this.pathService, this.viewDescriptorService, this.logService, - (workspaceFolder: IWorkspaceFolder) => { - if (!workspaceFolder) { + (workspaceFolder: IWorkspaceFolder | undefined) => { + if (workspaceFolder) { + return this._taskSystemInfos.get(workspaceFolder.uri.scheme); + } else if (this._taskSystemInfos.size > 0) { + return this._taskSystemInfos.values().next().value; + } else { return undefined; } - return this._taskSystemInfos.get(workspaceFolder.uri.scheme); } ); } diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index a73e2f7d2f3..ffc8bb30a88 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -635,7 +635,7 @@ export class TerminalTaskSystem implements ITaskSystem { const folders = this.contextService.getWorkspace().folders; workspaceFolder = folders.length > 0 ? folders[0] : undefined; } - const systemInfo: TaskSystemInfo | undefined = this.currentTask.systemInfo = workspaceFolder ? this.taskSystemInfoResolver(workspaceFolder) : undefined; + const systemInfo: TaskSystemInfo | undefined = this.currentTask.systemInfo = this.taskSystemInfoResolver(workspaceFolder); let variables = new Set(); this.collectTaskVariables(variables, task); diff --git a/src/vs/workbench/contrib/tasks/common/taskSystem.ts b/src/vs/workbench/contrib/tasks/common/taskSystem.ts index 7f5b1758e18..75c7dea7a92 100644 --- a/src/vs/workbench/contrib/tasks/common/taskSystem.ts +++ b/src/vs/workbench/contrib/tasks/common/taskSystem.ts @@ -125,7 +125,7 @@ export interface TaskSystemInfo { } export interface TaskSystemInfoResolver { - (workspaceFolder: IWorkspaceFolder): TaskSystemInfo | undefined; + (workspaceFolder: IWorkspaceFolder | undefined): TaskSystemInfo | undefined; } export interface ITaskSystem { -- GitLab