Skip to content

Show New Chat as a "New" split button in the Chat view's sessions list title - #350601

Draft
Sandeep Somavarapu (sandy081) wants to merge 10 commits into
mainfrom
agents/sessions-list-new-split-button
Draft

Sandeep Somavarapu (sandy081) wants to merge 10 commits into
mainfrom
agents/sessions-list-new-split-button

Conversation

@sandy081

Copy link
Copy Markdown
Member

When the sessions list is shown in the Chat view, its title shows New Chat as a "New" split button. The main part starts a new chat and shows its keybinding, for example "New ⌘N". The chevron opens the same New menu as before (New Chat, New Chat Editor, New Chat Window). This is on by default wherever the sessions list title is shown.

The button adapts to the space actually available, with no fixed width breakpoints. It has three sizes: "New ⌘N | ▾", then "New | ▾", then "+ | ▾". It always picks the largest size that still leaves room before the next title action. The size is picked after layout and before paint, so the button never overlaps its neighbors, not even for one frame. When the Chat view is moved to a place without the responsive title toolbar, it shows "+ | ▾".

Main parts:

  • ChatViewNewSplitButtonActionViewItem renders the split button. It measures the room before the next title action and picks the size. It updates when the title width, the other actions, their margins, the label or keybinding fonts, or the keybindings change, and it skips the work when none of these changed.
  • The sessions list's title creates this item for the New menu.
  • The Chat view refreshes its title actions when the sessions list appears.

No shared toolbar, action bar or layout code changes.

Known limit: at extreme side bar widths (below about 260px), the title toolbar's own overflow handling moves the button into the "…" menu, like any other title action.

How to test:

  1. Enable chat.viewSessions.sessionsList.enabled and open the Chat view.
  2. The title shows "New ⌘N | ▾". Click "New" to start a new chat; click ▾ to open the New menu.
  3. Narrow the side bar. ⌘N disappears just before the button would touch the next icon, then the label becomes "+", and at extreme widths the button moves into "…". Widen it again and each size comes back. Check light, dark and high contrast themes.
  4. Keyboard: focus "New", press Right Arrow to reach ▾, then press Enter or Space to open the menu.

Written by GitHub Copilot on behalf of Sandeep Somavarapu (@sandy081)

Copilot AI balanced review requested due to automatic review settings November 26, 2026 21:37
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.149.0 milestone Nov 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The split button can overlap neighboring actions after margin changes, suppress menu-command error notifications, and unintentionally collapse the Chat pane on touch activation.

3 open issues
What changed in this PR

Adds a responsive “New” split button to the Chat view’s sessions-list title, while preserving the existing New menu and leaving shared toolbar code unchanged.

Changes:

  • Adapts the button between label-with-keybinding, label-only, and icon-only sizes.
  • Integrates the button with the sessions list and refreshes title actions when the list changes.
  • Adds browser tests for sizing, action execution, menu contents, and title refreshes.
File Description
src/​vs/​workbench/​contrib/​sessions/​test/​browser/​agentsView/​chatViewNewSplitButton.test.ts Tests split-button behavior and responsive sizing.
src/​vs/​workbench/​contrib/​sessions/​browser/​media/​chatViewNewSplitButton.css Styles the button’s three sizes and keybinding hint.
src/​vs/​workbench/​contrib/​sessions/​browser/​agentsView/​chatViewSessionsList.ts Creates the custom button for the New menu.
src/​vs/​workbench/​contrib/​sessions/​browser/​agentsView/​chatViewNewSplitButton.ts Implements sizing, action execution, and focus handling.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widgetHosts/​viewPane/​chatViewPane.test.ts Verifies title-action refreshes when the sessions list changes.
src/​vs/​workbench/​contrib/​chat/​browser/​widgetHosts/​viewPane/​chatViewPane.ts Refreshes title actions when the sessions control becomes available or changes.

Review effort: Balanced

…t title

While the Chat view shows the shared sessions list, its New Chat title action
renders as a split button: "New" with the keybinding of New Chat, and a chevron
that opens the same New Chat menu as before. It reuses ButtonWithDropdown and
KeybindingLabel with the Agents window's New button colors, and hides the
keybinding when the title is narrow. The Chat view's own sessions list keeps
its current title action.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The primary button never gets the monaco-text-button class, so its padding,
gap and border rules did not apply.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Instead of a fixed title width, the New split button measures its full
"New ⌘N | ▾" width against the next title action and hides the keybinding
exactly when it would touch it, showing it again when space returns. It
observes the title's size, like the toolbar's responsive behavior, and
rechecks when keybindings change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The toolbar now reserves the width that the button reports for its compact
form, also while it is overflowed, so the compact button never overlaps the
next action. The keybinding's fit is also updated when the other actions or
the title change at a constant width, and the icon variants of New Chat show
its keybinding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The button picks its largest size that keeps a pixel before the next
title action, before paint: "New ⌘N | ▾", then "New | ▾", then the
icon with its dropdown. It shows the icon outside the responsive title
toolbar of the Chat view. The shared toolbar and action bar are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the keybinding measurable in every size and observe it, so a font
change at the same width fits the button again before the paint. Skip
laying out the sizes again when the widths the fit depends on and the
current size are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A replaced action can have contents of the same width but take other room
around them, so a membership change invalidates the cached fit, and the fit
inputs include the display, margins and minimum width of the other actions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The menu's runner rethrows the title runner's error, so the context menu
reports a failed command when the Chat view is in a pane header without
the composite title's error listener. Both parts of the button consume
taps, so a containing pane header does not toggle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/sessions-list-new-split-button branch from b5d1f04 to 8b008af Compare November 26, 2026 22:16
The New split button's menu runner now owns the errors of the actions it runs: it reports them with the notification service, as it outlives the menu, which stops listening when it closes. It runs the actions with the title's context but not through the title's runner, so a composite title, which reports its runner's errors, does not report them twice. Cancellations are not reported.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The toolbar disposes the button when it moves New into its overflow, which stopped a pending menu command from reporting its error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

2 participants