Skip to content

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

Merged
meganrogge merged 2 commits intomicrosoft:mainfrom
jamestut:fix-terminal-editor-split
Apr 15, 2026
Merged

await openEditor in terminal editor split to prevent shadow tab#309167
meganrogge merged 2 commits intomicrosoft:mainfrom
jamestut:fix-terminal-editor-split

Conversation

@jamestut
Copy link
Copy Markdown
Contributor

@jamestut jamestut commented Apr 11, 2026

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.

fixes #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.

Copy link
Copy Markdown
Collaborator

@meganrogge meganrogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@meganrogge meganrogge merged commit 77c315e into microsoft:main Apr 15, 2026
26 checks passed
@jamestut jamestut deleted the fix-terminal-editor-split branch April 16, 2026 14:15
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.

Create new split terminal is glitching when the terminal is on the editor area

3 participants