Repository navigation
Fix parentTerminal being ignored for terminals that have already opened - #342420
Merged
Megan Rogge (meganrogge) merged 2 commits intoNov 5, 2026
Merged
Megan Rogge (meganrogge) merged 2 commits into
Megan Rogge (meganrogge) merged 2 commits into
Conversation
…ened Once a terminal has opened, the extension host refers to it by its instance id rather than the identifier it was created with. The main thread only looked the parent up by the creation identifier, so `parentTerminal` was ignored for any terminal that had already opened, e.g. one from `window.terminals`. Fixes microsoft#205254
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix includes regression coverage for both identifier forms, with no actionable issues identified.
No open issues 🎉
What changed in this PR
Fixes #205254 so parentTerminal correctly splits from terminals that have already opened.
Changes:
- Uses the existing resolver for both creation identifiers and numeric instance IDs.
- Adds regression tests covering both identifier forms.
| File | Description |
|---|---|
| src/vs/workbench/api/test/browser/mainThreadTerminalService.test.ts | Tests parent-terminal splitting with both identifier types. |
| src/vs/workbench/api/browser/mainThreadTerminalService.ts | Resolves parents through _getTerminalInstance. |
Review effort: Balanced
Megan Rogge (meganrogge)
approved these changes
Nov 3, 2026
Megan Rogge (meganrogge)
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the fix!
Megan Rogge (meganrogge)
enabled auto-merge (squash)
November 3, 2026 19:30
roblourens
approved these changes
Nov 3, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 3, 2026
Dmitriy Vasyura (dmitrivMS)
added a commit
that referenced
this pull request
Nov 9, 2026
…346704) * terminal: ignore background instances as API split parents Follow up on #342420 and preserve the parentTerminal fix for #205254 while falling back to the default location for hidden or backgrounded parents. Co-authored-by: Copilot <[email protected]> * terminal: preserve hidden editor split parents Keep editor-targeted API split parents even when hidden or backgrounded, while retaining foreground validation for panel parents. Cover both terminal identifier types with regression tests. Co-authored-by: Copilot <[email protected]> * terminal: preserve panel location for background children Use an explicit panel location when a resolved background panel parent cannot be split. Preserve the parent location for visible and hidden children even with an editor default, with regression coverage for both terminal identifier types. Co-authored-by: Copilot <[email protected]> * terminal: preserve cwd inheritance for hidden children Retain the resolved split parent for hidden-child requests so initial and inherited cwd settings keep working. Preserve explicit cwd overrides and keep the panel fallback for visible children of background parents. Co-authored-by: Copilot <[email protected]> * terminal: clarify split handling and harden regression tests Clarify the hidden-child cwd path, explicitly type captured test results, and locate the child terminal by its extension identifier. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #205254
window.createTerminal({ location: { parentTerminal } })only splits from the parent when the parent hasn't opened yet, e.g. when both terminals are created at the same moment. For a terminal that has already opened, such as one fromwindow.terminalsor one created earlier and kept around, the option is silently ignored and the new terminal opens on its own.Before a terminal opens, the extension host identifies it by the string id it was created with. Once
$acceptTerminalOpenedruns, it switches to the terminal's numeric instance id (ExtHostTerminal._id).MainThreadTerminalService._deserializeParentTerminalonly looked the parent up in_extHostTerminals, which is keyed by the creation id, so an instance id never matched. The fix uses the existing_getTerminalInstance, which handles both kinds of identifiers.How to test
Unit tests in
mainThreadTerminalService.test.ts:splits from a parent terminal referenced by its instance id: the case from the issue. It fails without the fix and passes with it.splits from a parent terminal referenced by its extension identifier: the case that already worked, to make sure it still does.Manual check with an extension:
The child should open split next to the parent instead of in its own group.