diff --git a/src/vs/workbench/contrib/terminal/browser/terminal.ts b/src/vs/workbench/contrib/terminal/browser/terminal.ts index d9c9c6f1adf0d..3fd1d297a431b 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminal.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminal.ts @@ -624,7 +624,7 @@ export interface ITerminalEditorService extends ITerminalInstanceHost { openEditor(instance: ITerminalInstance, editorOptions?: TerminalEditorLocation): Promise; detachInstance(instance: ITerminalInstance): void; - splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig?: IShellLaunchConfig): ITerminalInstance; + splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig?: IShellLaunchConfig): Promise; revealActiveEditor(preserveFocus?: boolean): Promise; resolveResource(instance: ITerminalInstance): URI; reviveInput(deserializedInput: IDeserializedTerminalEditorInput): EditorInput; diff --git a/src/vs/workbench/contrib/terminal/browser/terminalEditorService.ts b/src/vs/workbench/contrib/terminal/browser/terminalEditorService.ts index 4f8a381ebeee9..3bf35662d68e0 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalEditorService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalEditorService.ts @@ -212,7 +212,7 @@ export class TerminalEditorService extends Disposable implements ITerminalEditor return getInstanceFromResource(this.instances, resource); } - splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig: IShellLaunchConfig = {}): ITerminalInstance { + async splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig: IShellLaunchConfig = {}): Promise { if (instanceToSplit.target === TerminalLocation.Editor) { // Make sure the instance to split's group is active const group = this._editorInputs.get(instanceToSplit.resource.path)?.group; @@ -223,7 +223,7 @@ export class TerminalEditorService extends Disposable implements ITerminalEditor const instance = this._terminalInstanceService.createInstance(shellLaunchConfig, TerminalLocation.Editor); const resource = this.resolveResource(instance); if (resource) { - this._editorService.openEditor({ + await this._editorService.openEditor({ resource: URI.revive(resource), description: instance.description, options: { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts index 5eaceee04d043..31ea089a3b0db 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts @@ -1066,7 +1066,7 @@ export class TerminalService extends Disposable implements ITerminalService { this._extensionService.activateByEvent('onTerminal:*'); let instance; if (parent) { - instance = this._splitTerminal(shellLaunchConfig, location, parent); + instance = await this._splitTerminal(shellLaunchConfig, location, parent); } else { instance = this._createTerminal(shellLaunchConfig, location, options); } @@ -1135,7 +1135,7 @@ export class TerminalService extends Disposable implements ITerminalService { } } - private _splitTerminal(shellLaunchConfig: IShellLaunchConfig, location: TerminalLocation, parent: ITerminalInstance): ITerminalInstance { + private async _splitTerminal(shellLaunchConfig: IShellLaunchConfig, location: TerminalLocation, parent: ITerminalInstance): Promise { let instance; // Use the URI from the base instance if it exists, this will correctly split local terminals if (typeof shellLaunchConfig.cwd !== 'object' && typeof parent.shellLaunchConfig.cwd === 'object') { @@ -1146,7 +1146,7 @@ export class TerminalService extends Disposable implements ITerminalService { }); } if (location === TerminalLocation.Editor || parent.target === TerminalLocation.Editor) { - instance = this._terminalEditorService.splitInstance(parent, shellLaunchConfig); + instance = await this._terminalEditorService.splitInstance(parent, shellLaunchConfig); } else { const group = this._terminalGroupService.getGroupForInstance(parent); if (!group) { diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index 46a6cff15b5ab..5f477c590d6f9 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -1819,7 +1819,7 @@ export class TestTerminalEditorService implements ITerminalEditorService { onDidChangeInstances = Event.None; openEditor(instance: ITerminalInstance, editorOptions?: TerminalEditorLocation): Promise { throw new Error('Method not implemented.'); } detachInstance(instance: ITerminalInstance): void { throw new Error('Method not implemented.'); } - splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig?: IShellLaunchConfig): ITerminalInstance { throw new Error('Method not implemented.'); } + splitInstance(instanceToSplit: ITerminalInstance, shellLaunchConfig?: IShellLaunchConfig): Promise { throw new Error('Method not implemented.'); } revealActiveEditor(preserveFocus?: boolean): Promise { throw new Error('Method not implemented.'); } resolveResource(instance: ITerminalInstance): URI { throw new Error('Method not implemented.'); } reviveInput(deserializedInput: IDeserializedTerminalEditorInput): TerminalEditorInput { throw new Error('Method not implemented.'); }