Skip to content

vscode: don't force-create a second editor group when spawning builder terminals — attach if exists, else use the default group #804

Description

@amrmelsayed

Problem

Spawning a builder terminal unconditionally targets vscode.ViewColumn.Two (packages/vscode/src/terminal-manager.ts:336). If the user only has one editor group open, VS Code creates a new second group to host the terminal. That's intrusive — the user's existing layout gets reshaped every time a builder spawns, even if they were happily working in a single column.

Desired behavior:

  • Second group exists → spawn in it (current behavior, preserved).
  • No second group exists → spawn in the first / default group instead of forcing a new one into existence.

This keeps the "builders live in the right pane" affordance for users who already work in a split, while staying out of the way for users who don't.

Current state

terminal-manager.ts:330–337:

letlocation: vscode.TerminalLocation|vscode.TerminalEditorLocationOptions;if(type==='dev'||position!=='editor'){location=vscode.TerminalLocation.Panel;}elseif(type==='architect'){location={viewColumn: vscode.ViewColumn.One};}else{location={viewColumn: vscode.ViewColumn.Two};// ← always Two, even if it doesn't exist}

ViewColumn.Two is fixed by ordinal — VS Code creates the group on demand if it isn't there.

Proposed behavior

For terminals that today resolve to ViewColumn.Two (the else branch — builder and shell types), conditionally pick the target column:

constgroupCount=vscode.window.tabGroups.all.length;location={viewColumn: groupCount>=2 ? vscode.ViewColumn.Two : vscode.ViewColumn.One};

Architect terminals (ViewColumn.One) and dev/panel terminals stay exactly as they are.

Acceptance criteria

  • When at least two editor groups exist at spawn time, a new builder terminal attaches to the second group (unchanged from today).
  • When only one editor group exists at spawn time, the new builder terminal attaches to the first/default group without creating a new group.
  • Same rule applies to shell-type terminals (they share the ViewColumn.Two branch today).
  • Architect terminals (ViewColumn.One) and dev / panel terminals are untouched.
  • No new configuration setting — the behavior is unconditional.
  • Existing focus / show(!focus) semantics preserved (cursor doesn't jump unexpectedly).

Out of scope

  • A user-facing setting to choose between "force second group" (old) and "attach if exists" (new).
  • Re-positioning existing builder terminals when the user later splits / unsplits groups.
  • Cross-builder grouping (e.g. all builders in one group, dev terminals elsewhere).

Related

Activity

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

Metadata

Metadata

Assignees

Labels

area/terminalArea: Terminal-specific (PTY, vscode terminal pane)projectNew project or feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions