Skip to content

Chat windows follow-ups: proportional resize, keyboard shortcuts, and drag-out/close fixes - #346039

Merged
Sandeep Somavarapu (sandy081) merged 14 commits into
mainfrom
agents/chat-windows-followups
Nov 4, 2026
Merged

Sandeep Somavarapu (sandy081) merged 14 commits into
mainfrom
agents/chat-windows-followups

Conversation

@sandy081

Copy link
Copy Markdown
Member

Follow-ups to #345683 for the chat windows of the Agents window (sessions.chatWindows.enabled). Regular VS Code layouts are unchanged; the only shared changes are a clamp in SplitView's proportional layout and Grid.resizeView accepting a single dimension, which GridView.resizeView already did.

Proportional resize

Resizing a chat window, for example to full screen, used to give all of the change to the last part of each row and column, because PartGrid laid out its grid without proportional layout.

  • Parts now keep their shares of the window as it is resized. Chrome that isn't a part, such as the title row and the strip, keeps its size.
  • The terminals keep their height, as the panel does in the main window. A part can opt in with IPartGridPartOptions.keepsSize. PartGrid gives it its size back after each layout, and the parts beside it make room in proportion, from unrounded shares, so dragging a window out and back returns the exact sizes.
  • SplitView clamps a view that keeps its size to its bounds in proportional layout, for example a title row restored at a larger size.
  • The preview of where a dragged part goes is laid out proportionally too.

Keyboard shortcuts in chat windows

  • The Changes, Files, Browser and Search Add Tab commands now work in a chat window. They open their tab in the window's main part, so the default and user keybindings to them work there.
  • They delegate to a chat window only when invoked from it. Menu entries name their editor group or window, so a click in the main window stays in the main window even while a chat window has focus. Without context arguments, as from a keybinding or the Command Palette, they act on the chat window that has focus.
  • F5 (Run) now applies in chat windows, where the Run button shows.
  • Cmd+B (Toggle Side Bar) is a no-op in a chat window instead of toggling the main window's side bar.

Drag-out and close fixes

  • Tabs and splits carried on reopen: when the chat moves into another window, the chat window reopens the chat's part with its tabs and splits. It captures the part as the chat is about to leave its group.
  • Edge drop: dropping the chat's group, with the chat alone in it, at the edge of another window moves the chat out instead of closing the chat window.
  • All-or-nothing close: closing checks every group of the window, including parts created by drops and non-terminal editors in the Terminals part, before anything closes. If the window cannot close, the chat that moved out goes back into its group.
  • No duplicate dirty editors: editors that ask before closing, such as dirty ones, are left to the close instead of also being moved into the main window, and a captured chat part beside a dirty editor is not reopened.
  • Veto message: a vetoed move-out, or a vetoed Close Chat Window, says why, as a vetoed editor move does.
  • The chat itself: the chat counts as still open in another window only where its own editor shows, not an editor that merely matches it.

Validation

On the final commit (8d42d30): typecheck, the chat window, chatWindowMoveEditors and sessions terminal suites, and ESLint on the changed files. The last two commits change only chatWindowService.ts and its tests; the other suites below ran on the commit before them (52bbaa6), with the same base.

  • corepack pnpm run build-fast --client-only: passed
  • corepack pnpm run typecheck-client: passed
  • ./scripts/test.sh --runGlob <suite>:
    • **/parts/partGrid/*.test.js: 62 passing
    • **/chatWindow/**/*.test.js (workbench and sessions): 197 passing
    • **/chatWindow/test/browser/chatWindowMoveEditors.test.js: 6 passing
    • **/browser/parts/editor/*.test.js: 375 passing
    • **/services/editor/test/browser/*.test.js: 286 passing
    • **/ui/splitview/*.test.js: 29 passing
    • **/ui/grid/*.test.js: 73 passing
    • **/sessions/contrib/terminal/**/*.test.js: 151 passing
    • **/sessions/contrib/editor/test/browser/editor.contribution.test.js: 45 passing
    • **/sessions/contrib/layout/test/browser/desktopLayoutController.test.js: 138 passing
    • **/sessions/test/browser/sessionActivityBar.test.js: 21 passing
    • **/sessions/test/browser/desktopEditorPart.test.js: 8 passing
    • **/sessions/test/browser/emptyEditorGroupAddTab.test.js: 2 passing
  • node test/unit/browser/index.js --browser chromium --run <file>:
    • src/vs/workbench/test/browser/parts/partGrid/partGrid.test.ts: 61 passing
    • src/vs/workbench/services/editor/test/browser/viewEditor.test.ts: 16 passing
    • src/vs/sessions/contrib/chatWindow/test/browser/sessionChatViewEditor.test.ts: 11 passing
  • corepack pnpm run eslint <changed files>: clean

New tests cover resizing a chat window out and back in uneven steps in Stacked, so the parts return to their exact sizes. They also cover the Add Tab delegation from keys and menu entries, and the drag-out and close cases above.

Resizing a chat window, such as to full screen, gave all the change to the
last part of each row and column: PartGrid laid its grid out without
proportional layout. Now parts keep their shares of the grid; views that are
not parts, such as the title row and the strip, keep their sizes.

- PartGrid lays its grid out proportionally; a cell is proportional only
  while it holds a part.
- A part can keep its size (IPartGridPartOptions.keepsSize), as the
  terminals of a chat window do. PartGrid gives it its size back after each
  layout, and the parts beside it make room in proportion to their sizes.
  Opting it out of proportional layout would also keep the size of the row
  or column around it.
- SplitView keeps a view that keeps its size within its bounds in
  proportional layout, such as a title row restored at a third of the grid.
- Grid.resizeView and PartGrid.resizeCell resize one dimension when given
  only that, so that keeping the terminals' height does not save the shares
  of the parts beside them again, rounded.

Co-authored-by: Copilot <[email protected]>
…expected in chat windows

The Changes, Files, Browser and Search Add Tab commands now also apply in a chat
window. There they open their tab in the window's main part, for the window's
session, through the window's own commands, so default and user keybindings to
them work in chat windows. Their menu entries stay in the main window.

F5 Run now applies in chat windows, where the Run button shows. Cmd+B no
longer toggles the main window's side bar from a chat window.

Co-authored-by: Copilot <[email protected]>
Each layout of a grid with a part that keeps its size, such as a chat
window's terminals, ended by resizing the parts beside it from their
rounded sizes, which the split view then saved as their proportions again.
While a window was dragged, the main part and the chat drifted a pixel
here and there. Now they take the unrounded shares they had, remembered as
long as nothing else resized them, such as a sash or the grid arranged
again, rounded by where they end. Each resize reads the line again, as
the ones before it change it.

The preview of where a part goes lays its grid out proportionally too, as
the grid does.

Co-authored-by: Copilot <[email protected]>
…indow

Address review: an Add Tab command delegates to a chat window only when it runs
there. Its menu entries name where they run: by their editor group (now also for
empty groups) or by their window (the Session Activity Bar now names its window
in the main window too). Without arguments, as from a keybinding or the Command
Palette, it acts on the chat window that has focus. A click in the main window
while a chat window still has focus therefore stays in the main window.

Toggle Side Bar now also has a precondition, so the Command Palette cannot
toggle the main window's side bar from a chat window.

Co-authored-by: Copilot <[email protected]>
…t has focus

Arguments that name neither an editor group nor a window, such as those of a
keybinding in keybindings.json, no longer prevent an Add Tab command from acting
on the chat window that has focus.

Co-authored-by: Copilot <[email protected]>
…window everywhere

The empty-group Add Tab fixtures pass the group id the Add Tab entries now run
with. The Session Activity Bar test expects the main window's entries to run with
their window too, as they now do, so that they never act on a chat window that
has focus.

Co-authored-by: Copilot <[email protected]>
…rt, no duplicate dirty editors

F1: the chat moving into another window opened it again without the tabs
beside it: the chat part was captured after the chat left its group. The
window remembers the group the chat left and captures the part with the
chat back in that group.

F2: closing checked only the main part and the chat part for editors that
cannot move; those of parts the window created for drops could veto after
the rest had closed. It checks every group of the window, but the
terminals'.

F3: editors that ask before they close, such as dirty ones, were both
serialized and merged into the main window by the close: they are left to
the close.

Co-authored-by: Copilot <[email protected]>
- G1: capture the chat part as the chat is about to leave its group, so the
  groups split beside it survive when its group goes away on drag-out.
- G2: a non-terminal editor in the Terminals part that cannot move to the main
  window keeps the window open; only terminals are skipped.
- G3: when the window cannot close, the chat that moved out goes back into its
  group instead of leaving a window without a chat.
- Residual: with a dirty editor beside the chat, the captured chat part is not
  reopened (it would show that editor twice); its other editors open in the
  main part.

Co-authored-by: Copilot <[email protected]>
- H1: when the chat's group moves to another window, the group closes the chat
  instead of moving it. If the chat is still open in another window, treat it
  as a move-out (or bounce it back on a veto) instead of closing the window.
- H2: the chat part captured as the chat left is used only while the chat is
  out of the window, not after it moved into another part of it.
- H3: a vetoed move-out shows why, as a vetoed editor move does.

Co-authored-by: Copilot <[email protected]>
…close says why

- Whether the chat is still open in a group of another window counts only
  its own editor, not one that merely matches it.
- Closing a chat window that cannot close, such as for an editor that
  cannot move to the main window, says why, as the chat moving out of the
  window does.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 14:55

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

Unresolved regressions lose tabs and splits when moving chats, open Search in the wrong part, reuse browser tabs instead of creating new ones, and break proportional layout resizing.

5 open issues
What changed in this PR

This PR follows up on the Agents window’s chat-window implementation, improving resize behavior, command routing, and moving or closing chats across windows.

Changes:

  • Adds proportional part resizing while preserving chrome and terminal sizes.
  • Enables chat-window keyboard shortcuts and routes menu actions using their originating group or window.
  • Updates chat-part restoration, close-veto handling, and dirty-editor preservation, with regression tests.
File Description
src/​vs/​workbench/​test/​browser/​parts/​partGrid/​partGrid.test.ts Tests proportional resizing and updates drag-preview expectations.
src/​vs/​workbench/​contrib/​chatWindow/​test/​browser/​chatWindowMoveEditors.test.ts Tests avoiding duplicate dirty editors during reopening.
src/​vs/​workbench/​contrib/​chatWindow/​test/​browser/​chatWindowGrid.test.ts Tests resize round trips and fixed terminal height.
src/​vs/​workbench/​contrib/​chatWindow/​test/​browser/​chatWindow.test.ts Tests chat moves, state capture, close vetoes, and editor identity.
src/​vs/​workbench/​contrib/​chatWindow/​browser/​chatWindowService.ts Adds move-state capture, window-wide veto checks, and veto messages.
src/​vs/​workbench/​contrib/​chatWindow/​browser/​chatWindowLayoutActions.ts Separates explicit command-context resolution from focus fallback.
src/​vs/​workbench/​contrib/​chatWindow/​browser/​chatWindowGrid.ts Uses fixed-size terminal options and height-only resizing.
src/​vs/​workbench/​contrib/​chatWindow/​browser/​chatWindowEditors.ts Excludes confirmation-requiring editors from serialized transfers.
src/​vs/​workbench/​browser/​parts/​partGrid/​partGrid.ts Adds proportional layout and fixed-size part restoration.
src/​vs/​sessions/​test/​browser/​sessionActivityBar.test.ts Verifies activity-bar actions receive window context.
src/​vs/​sessions/​test/​browser/​emptyEditorGroupAddTab.test.ts Supplies group identity to the Add Tab test.
src/​vs/​sessions/​test/​browser/​emptyEditorGroupAddTab.fixture.ts Supplies group identity to the Add Tab fixture.
src/​vs/​sessions/​test/​browser/​desktopEditorPart.test.ts Updates the empty-group stub with an identifier.
src/​vs/​sessions/​contrib/​layout/​test/​browser/​layoutControllerTestUtils.ts Stubs chat-window focus for main-window tests.
src/​vs/​sessions/​contrib/​editor/​test/​browser/​editor.contribution.test.ts Updates action tests for chat-window service dependencies.
src/​vs/​sessions/​contrib/​editor/​browser/​addTabActions.ts Enables and routes Add Tab commands in chat windows.
src/​vs/​sessions/​contrib/​chatWindow/​test/​browser/​chatWindowContribution.test.ts Tests shortcut availability and context-based command routing.
src/​vs/​sessions/​contrib/​chatWindow/​browser/​chatWindowActions.ts Reuses shared command identifiers and workspace conditions.
src/​vs/​sessions/​contrib/​chat/​browser/​runScriptAction.ts Enables F5 in chat windows.
src/​vs/​sessions/​common/​sessionCommands.ts Defines shared chat-window tab command identifiers.
src/​vs/​sessions/​common/​contextkeys.ts Shares the session-with-workspace condition.
src/​vs/​sessions/​browser/​parts/​sessionActivityBar.ts Passes the originating window to activity-bar actions.
src/​vs/​sessions/​browser/​parts/​emptyEditorGroupAddTab.ts Passes group context through Add Tab controls and submenus.
src/​vs/​sessions/​browser/​layoutActions.ts Disables Toggle Side Bar in chat windows.
src/​vs/​base/​test/​browser/​ui/​splitview/​splitview.test.ts Tests bounds clamping for fixed-size views.
src/​vs/​base/​browser/​ui/​splitview/​splitview.ts Clamps non-proportional views to their size bounds.
src/​vs/​base/​browser/​ui/​grid/​grid.ts Allows resizing a single dimension.

Review effort: Balanced

A group fires onWillCloseEditor once the editor already left its model, so
the chat part captured then had no chat and the tabs and splits beside it
were lost as the chat moved to another window. Capture on the first
onWillMoveEditor of a move out of the chat's group, also as its group
merges into another one editor at a time, and on a new
IContentPart.onWillMoveGroupOut as the group moves to another part, which
copies it there and force closes its editors here. The test group follows
the real order of close events.

Co-authored-by: Copilot <[email protected]>
…t as in the main window

Add Browser Tab always opens a new pinned browser tab, rather than the
activity bar entry's reuse of an existing one as a preview. Search opens
by the scoped services of the main part, as activating its group does not
make it the active part while another part has focus.

Co-authored-by: Copilot <[email protected]>
…eps its share

keepSizes resized the others in a line by an immediate view of each, which
a row or column of rows or columns only does not have, so its resize was
skipped. Resize the nodes by their location in the grid instead.

Co-authored-by: Copilot <[email protected]>
@sandy081
Sandeep Somavarapu (sandy081) merged commit c4e701c into main Nov 4, 2026
107 of 109 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the agents/chat-windows-followups branch November 4, 2026 18:50
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 4, 2026
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Nov 11, 2026
…+Shift+G in the chat window that has focus (#347613)

* Agents window: keep Cmd/Ctrl+B and Cmd/Ctrl+O in the chat window that has focus

In a chat window, Cmd/Ctrl+B toggled the main window's side bar and
Cmd/Ctrl+O (New Session in Folder...) started the new session in the main
window.

- Cmd/Ctrl+B: #346039 made the Agents window's Toggle Side Bar not apply in
  chat windows, but VS Code's generic Toggle Primary Side Bar Visibility, also
  loaded in the Agents window, still claimed the key there and toggled the main
  layout. It no longer applies in windows with layout modes either, so the key
  does nothing in a chat window, which has no side bar of its own.
- Cmd/Ctrl+O: the command now resolves the chat window it runs in and opens the
  new session there as Cmd/Ctrl+N does, aimed at the picked folder, through a
  new provider-neutral `folder` option of IChatWindowService.openNewChat. An
  unsent new session that is active there is aimed at the folder instead. The
  main window is unchanged.

Fixes #347106

Co-authored-by: Copilot <[email protected]>

* Agents window: open a new composer for a folder picked in a chat window

New Session in Folder in a chat window re-aimed an unsent active composer by
changing only what it requested, which its mounted composer does not follow:
it kept its draft in the previous folder. A picked folder now always opens a
new composer, which creates its draft through the composer's own path,
including its trust gate. It replaces the active composer when closing it
loses nothing (no input and no request under way); otherwise it opens as a
tab of it.

The composer also starts with the session type of the provider that
resolved the folder, so that this provider creates its draft, as a new
session in a folder of a provider starts in the main window.

Co-authored-by: Copilot <[email protected]>

* Agents window: keep a composer that changed while a folder's composer opened

A composer that New Session in Folder replaces in a chat window was checked
for losing nothing only before the new composer opened, which is awaited:
input typed into it, or a request it sent, meanwhile was lost as it closed.
It is now checked again before it closes.

A composer opened for a folder from a composer that has not sent its session
also joins the custom group of the sessions list that composer's sessions
join; its draft is not in a group yet.

Co-authored-by: Copilot <[email protected]>

* Agents window: keep Cmd/Ctrl+Shift+E and Ctrl+Shift+G in a chat window with a new session

In a chat window whose active chat is a new-session composer, Cmd/Ctrl+Shift+E
opened the Files view in the main window's auxiliary bar rather than a Files
tab in the chat window; Changes did the same.

- The keys of a host's session took the workspace of the chat it shows only, so
  while a composer shows no chat yet, its session counted as one without a
  workspace, although its draft has a folder, and the chat window's Files and
  Changes keys did not apply. The workspace is now the session's while the host
  shows no chat of it.
- Where those keys did not apply, the open commands of the Files and Changes
  view containers claimed them and opened the main window's auxiliary bar. The
  keys of a view container's open command no longer apply in a window with
  layout modes, whose parts are not the main window's. Their commands, as in the
  Command Palette, are unchanged.

Fixes #347106

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
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.

5 participants