Skip to content

parentTerminal doesn't always work  #205254

Description

@drrnkin

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
    Version: 1.86.1 (system setup)
    Commit: 31c37ee
    Date: 2024-02-07T09:08:20.941Z
    Electron: 27.2.3
    ElectronBuildId: 26495564
    Chromium: 118.0.5993.159
    Node.js: 18.17.1
    V8: 11.8.172.18-electron.0
    OS: Windows_NT x64 10.0.19045
  • OS Version:
    Edition Windows 10 Enterprise
    Version 22H2
    Installed on ‎1/‎15/‎2021
    OS build 19045.3930
    Experience Windows Feature Experience Pack 1000.19053.1000.0

Steps to Reproduce:

This is precisely the same as #131594. The OP-provided code opens terminals that are separate from each other (not split). Ditto for the very similar code quoted in response (the last block). Unfortunately the OP did not follow up but I'm seeing exactly the same issue.

I've definitely seen parentTerminal work when creating two terminals at the same moment and making one the parentTerminal of the other. The option seems to be ignored if the supplied terminal was not created at the same moment, i.e. stored and used in a subsequent call.

Activity

  1. apeters-brex commented on Mar 29, 2024

    @apeters-brex

    For me, the example from #131594 works, but fails when I try to split from an existing terminal (one not created within that same function).

    For instance, if you take that same snippet and change options_1 to include

    location: { parentTerminal: vscode.window.terminals[0] },
    

    Then run the command when you have an existing terminal, terminal_1 does not get split from that existing terminal.

  2. added
    bugIssue identified by VS Code Team member as probable bug
    help wantedIssues identified as good community contribution opportunities
    and removed
    terminalGeneral terminal issues that don't fall under another label
    on Dec 11, 2024
  3. DeeHants commented on Apr 30, 2025

    @DeeHants

    I'm seeing very similar, I created terminals in a loop, with 2nd onwards using parentTerminal.
    If I have an async "delay" between entries, the parent is ignored.

    export async function delay(milliseconds: number) {
      await new Promise((resolve) => setTimeout(resolve, milliseconds));
    }
    

    If I remove the delay, it all works exactly as expected.

    I do not have a solution yet.

  4. TristanSpeakEasy commented on Feb 24, 2026

    @TristanSpeakEasy

    Have just run into this myself, need to create split terminals from already existing terminals but it won't work and I don't have the option of creating them at the same time

  5. erikmueller commented on Apr 24, 2026

    @erikmueller

    Also ran into this. Can confirm that a delay is probably causing this. It seems like it stops working as soon as the terminal that should be used as a parent ran through the TerminalService's acceptTerminalOpened. After this it gets assigned some kind of internal instance id and the lookup for the parent fails from here on.

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

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunitiesterminal-tabs

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions