Skip to content

Commit

Permalink
Fallback to first remote task info when no folder is open
Browse files Browse the repository at this point in the history
Previous behavior was to fallback to local. It makes more sense to fallback to the the first remote details instead
Related to microsoft/vscode-docker#2350
  • Loading branch information
alexr00 authored and meganrogge committed Oct 1, 2020
1 parent 564f74b commit 8263795
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
this.collectTaskVariables(variables, task);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/tasks/common/taskSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export interface TaskSystemInfo {
}

export interface TaskSystemInfoResolver {
(workspaceFolder: IWorkspaceFolder): TaskSystemInfo | undefined;
(workspaceFolder: IWorkspaceFolder | undefined): TaskSystemInfo | undefined;
}

export interface ITaskSystem {
Expand Down

0 comments on commit 8263795

Please sign in to comment.