You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
terminal: preserve parent location for background terminal children - #346704
Prevent API child-terminal creation from trying to split a hidden or backgrounded panel parent that has no terminal group, while preserving the parent's location as promised by TerminalSplitLocationOptions.
For a resolved background panel parent, pass TerminalLocation.Panel instead of a split parent. The child stays in the panel even when terminal.integrated.defaultLocation is editor; the parent remains hidden.
Preserve editor-targeted parents, including hidden/backgrounded editor parents. Editor splits do not require a parent terminal group.
Preserve normal foreground splits, including previously hidden parents after they are shown, and support both creation identifiers and numeric instance IDs.
Keep the existing default-location fallback for an unresolved parent only.
The explicit panel location also preserves hidden-child creation, which already bypasses splitting. The earlier implementation's fallback to the configured default was incorrect for resolved background panel parents.
Add regression coverage for hidden/backgrounded panel and editor parents, both identifier types, shown parents, and visible/hidden children with an editor default.
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]>
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues remain for the change restricting API split parents to foreground terminals.
No open issues 🎉
What changed in this PR
This PR follows up on the parentTerminal fix for #205254 by excluding background terminals as API split parents. Children fall back to the configured default location, while previously hidden parents remain valid after being shown.
Changes:
Require foreground membership when resolving split parents, preserving support for creation identifiers and numeric instance IDs.
Add five regression tests covering hidden parents, shown parents, and visible parents moved to the background.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Splitting from a hidden or backgrounded editor parent can send the child terminal to the default location instead of preserving the parent’s editor location, regressing the API contract.
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]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
With an editor default, children of hidden or backgrounded panel terminals can be placed in the editor, violating the promised preservation of the parent’s panel location.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Hidden panel parents should retain the panel terminal location
When terminal.integrated.defaultLocation is editor, a hidden/backgrounded panel parent now sends its child to the editor instead of preserving the panel location promised by TerminalSplitLocationOptions (src/vscode-dts/vscode.d.ts:7785). This also changes hidden-child creation, which previously kept the parent's location without attempting a split. Return TerminalLocation.Panel for a resolved background panel parent, and add a regression test with an editor default.
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]>
Dmitriy Vasyura (dmitrivMS)
changed the title
terminal: ignore background instances as API split parents
terminal: preserve parent location for background terminal children
Nov 9, 2026
Addressed the "previously missed issue" in #346704 (review) with commit b0b1662. Resolved hidden/backgrounded panel parents now pass an explicit TerminalLocation.Panel rather than falling back to the configured default. This preserves the location for both visible and hidden children, while keeping editor-targeted parents and ordinary foreground splits intact.
All eight new panel-parent/editor-default cases failed before the correction and now pass (hidden/backgrounded parent, creation/numeric identifier, visible/hidden child). The full terminal API suite passes all 34 tests; client compilation/type checking and staged-file hygiene also pass.
I corrected the PR description and manual steps, including the earlier UI expectation: a hidden panel parent must keep its child in the panel even with an editor default. The older recording is not validation of this final correction; a fresh end-to-end UI run has not been performed. This finding was embedded in the review summary, so there is no separate inline thread to resolve.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Hidden child terminals without an explicit cwd lose a hidden or backgrounded parent’s working directory when splitCwd is initial or inherited, launching in the default directory instead.
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]>
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]>
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
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.
Related to #205254.
Follow-up to #342420, addressing Copilot's original feedback, the hidden-editor-parent finding, and the previously missed panel-location finding.
Prevent API child-terminal creation from trying to split a hidden or backgrounded panel parent that has no terminal group, while preserving the parent's location as promised by
TerminalSplitLocationOptions.TerminalLocation.Panelinstead of a split parent. The child stays in the panel even whenterminal.integrated.defaultLocationiseditor; the parent remains hidden.The explicit panel location also preserves hidden-child creation, which already bypasses splitting. The earlier implementation's fallback to the configured default was incorrect for resolved background panel parents.
Add regression coverage for hidden/backgrounded panel and editor parents, both identifier types, shown parents, and visible/hidden children with an editor default.