Skip to content

await openEditor in terminal editor split to prevent shadow tab#309167

Open
jamestut wants to merge 1 commit intomicrosoft:mainfrom
jamestut:fix-terminal-editor-split
Open

await openEditor in terminal editor split to prevent shadow tab#309167
jamestut wants to merge 1 commit intomicrosoft:mainfrom
jamestut:fix-terminal-editor-split

Conversation

@jamestut
Copy link
Copy Markdown
Contributor

When splitting a terminal that's in the editor area (via the "Split Terminal" command), the new terminal correctly opens in a new editor group to the side, but a duplicate "shadow tab" also appears in the original editor group.

Issue #291578

Root Cause

TerminalEditorService.splitInstance called this._editorService.openEditor(...) with SIDE_GROUP but did not await it. The call was fire-and-forget.

After createTerminal returned, the Split action called focusActiveTerminalfocusInstance_revealEditor, which called openEditor again without specifying a target group. Since the first openEditor hadn't completed yet, the editor wasn't in any group, so findGroup defaulted to the active group — the original group containing the parent terminal. This created a duplicate tab.

This regression was introduced by the new _revealEditor logic in focusInstance (added after 1.106.0). In 1.106.0, focusInstance was just instance.focusWhenReady(true) with no openEditor call, so the race couldn't occur.

Fix

Await the openEditor in splitInstance so the new terminal is fully opened in the correct side group before focusInstance runs.

Testing

  1. Open a new terminal in the editor area.
  2. Run the Split Terminal command.

Previously, a shadow terminal tab would appear in the original editor group. After the fix, it no longer does so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants