Skip to content

Terminal: add move tab up/down and kill terminals below#309084

Open
iliazlobin wants to merge 9 commits intomicrosoft:mainfrom
iliazlobin:terminal-move-tab-kill-below
Open

Terminal: add move tab up/down and kill terminals below#309084
iliazlobin wants to merge 9 commits intomicrosoft:mainfrom
iliazlobin:terminal-move-tab-kill-below

Conversation

@iliazlobin
Copy link
Copy Markdown

@iliazlobin iliazlobin commented Apr 10, 2026

Fixes #309068

Summary

  • Add Move Terminal Tab Up / Move Terminal Tab Down commands to reorder terminal groups via keyboard/Command Palette (precondition: groupCount > 1)
  • Add Kill Terminals Below command to kill all terminal groups below the active one, accessible from the terminal tab right-click context menu and Command Palette (precondition: groupCount > 1)
  • Move Up/Down are intentionally keyboard-only (no context menu entries), following the editor tabs pattern where reordering is not exposed in right-click menus

Changes

File What
terminal.ts (common) Added MoveTabUp, MoveTabDown, KillGroupsBelow to TerminalCommandId
terminal.ts (browser) Added moveGroupUp, moveGroupDown, getGroupsBelow to ITerminalGroupService
terminalGroupService.ts Implemented all three methods
terminalActions.ts Registered all three actions; group resolved from context args with fallback to active group
terminalMenus.ts Added Kill Terminals Below to terminal tab context menu
workbenchTestServices.ts Added stubs to TestTerminalGroupService

Test plan

  • Open multiple terminal tabs (3+)
  • Use Move Terminal Tab Up / Down (via keybinding or Command Palette) → verify tabs reorder correctly
  • Right-click a tab that isn't last → verify Kill Terminals Below kills all tabs below it
  • Right-click a tab that is last → verify Kill Terminals Below is hidden
  • Confirm Move Terminal Tab Up/Down appear in Command Palette
  • Confirm all three actions are hidden when only one terminal group exists

- Add MoveTabUp/MoveTabDown actions to reorder terminal groups in the tab list
- Add KillGroupsBelow action to kill all terminal groups below the active one
- Expose in terminal tab context menu; precondition requires groupCount > 1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 10, 2026 19:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new terminal tab management commands to reorder terminal groups and to bulk-kill terminal groups “below” the current one, integrating them into terminal actions/menus and updating the group service API.

Changes:

  • Added new command IDs: MoveTabUp, MoveTabDown, KillGroupsBelow.
  • Extended ITerminalGroupService and implemented group reordering + “groups below” lookup in TerminalGroupService.
  • Registered the new actions and added “Kill Terminals Below” to the terminal tab context menu.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/workbench/test/browser/workbenchTestServices.ts Updates TestTerminalGroupService to satisfy the expanded interface.
src/vs/workbench/contrib/terminal/common/terminal.ts Adds new TerminalCommandId entries for the commands.
src/vs/workbench/contrib/terminal/browser/terminalMenus.ts Adds the “Kill Terminals Below” tab context menu item.
src/vs/workbench/contrib/terminal/browser/terminalGroupService.ts Implements move up/down and groups-below helper methods.
src/vs/workbench/contrib/terminal/browser/terminalActions.ts Registers MoveTabUp/Down and KillGroupsBelow actions.
src/vs/workbench/contrib/terminal/browser/terminal.ts Extends ITerminalGroupService with the new methods.

Comment thread src/vs/workbench/contrib/terminal/browser/terminalActions.ts Outdated
Comment thread src/vs/workbench/contrib/terminal/browser/terminalActions.ts Outdated
Comment thread src/vs/workbench/contrib/terminal/browser/terminalMenus.ts
Ilia Zlobin and others added 3 commits April 12, 2026 20:08
…efore dispose, add move commands to context menu

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…elow

Move up/down are keyboard-only commands; context menu follows editor tabs
pattern which only has a "close to the right" equivalent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@iliazlobin
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@iliazlobin iliazlobin requested a review from Copilot April 14, 2026 20:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread src/vs/workbench/contrib/terminal/browser/terminalActions.ts Outdated
Comment thread src/vs/workbench/contrib/terminal/browser/terminalMenus.ts
Comment thread src/vs/workbench/contrib/terminal/browser/terminalGroupService.ts
Comment thread src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Ilia Zlobin and others added 5 commits April 15, 2026 21:11
- Add terminalGroupService.test.ts with 16 unit tests covering moveGroupUp,
  moveGroupDown, getGroupsBelow (no-op edges, ordering, activeGroupIndex tracking)
- Add terminalActiveGroupIsLast context key; use it to hide Kill Terminals Below
  when the right-clicked tab is the last one
- Check both focusedArgs and allInstanceArgs when resolving context instance

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Terminal: Add 'Move Terminal Tab Up/Down' commands to reorder tabs

3 participants