From 954686aae54fd75988bc46df97f01857ebcd7ad4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 21 Jul 2021 10:20:41 -0700 Subject: [PATCH] Only set active on last dropped instance Part of #126387 Co-Authored-By: Megan Rogge --- .../contrib/terminal/browser/terminalTabsList.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTabsList.ts b/src/vs/workbench/contrib/terminal/browser/terminalTabsList.ts index 43fc7b66a56..a3f716a6e62 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalTabsList.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalTabsList.ts @@ -628,7 +628,6 @@ class TerminalTabsDragAndDrop implements IListDragAndDrop { sourceInstances = [instance]; this._terminalService.moveToTerminalView(instance); } else if (this._offProcessTerminalService) { - // why is this undefined const terminalIdentifier = parseTerminalUri(uri); if (terminalIdentifier.instanceId) { promises.push(this._offProcessTerminalService.requestDetachInstance(terminalIdentifier.workspaceId, terminalIdentifier.instanceId)); @@ -637,9 +636,12 @@ class TerminalTabsDragAndDrop implements IListDragAndDrop { } let processes = await Promise.all(promises); processes = processes.filter(p => p !== undefined); + let lastInstance: ITerminalInstance | undefined; for (const attachPersistentProcess of processes) { - const instance = this._terminalService.createTerminal({ config: { attachPersistentProcess } }); - this._terminalService.setActiveInstance(instance); + lastInstance = this._terminalService.createTerminal({ config: { attachPersistentProcess } }); + } + if (lastInstance) { + this._terminalService.setActiveInstance(lastInstance); } return; }