Skip to content

chat windows: drag and drop between parts - #345685

Merged
Sandeep Somavarapu (sandy081) merged 74 commits into
agents/chat-windows-on-partsfrom
agents/parts-drag-and-drop
Nov 4, 2026
Merged

Sandeep Somavarapu (sandy081) merged 74 commits into
agents/chat-windows-on-partsfrom
agents/parts-drag-and-drop

Conversation

@sandy081

@sandy081 Sandeep Somavarapu (sandy081) commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Block 3 of the chat windows parts design: drag and drop between the parts of a chat window (DESIGN.md §6, D1–D5), each gesture with a command equivalent and a screen reader announcement.

Stacked on #345683 (Block 2, chat windows on parts, base agents/chat-windows-on-parts), which is based on main now that #345663 (Block 1) merged. Merges after #345683.

Regular VS Code is unchanged: a window with one editor part behaves as before, the new commands are Agents-window only (IsSessionsWindowContext plus the generic editorPartInPartGrid, set on the parts of a part grid), and D5 is behind sessions.chatWindows.enabled. One small change applies to regular VS Code too: an editor dropped into another part of the same window is announced to screen readers ("Moved {0} to {1}"), which includes moves between the main part and a modal editor part.

Commit map

Commit Change Tests
P13 e685e96cacc D1 + D2 Editors, and the chat, drag between parts and split a part at its edges. Inputs registered as drop targets (the chat input) take every drop on them; new registerContentDropTarget for content that handles its center drops (the chat view): editors/groups get the group's edge zones there, other drags are the content's. A view editor's drag handle drags it like a tab (singleton = move); the handle owns its drag and leaves text fields alone. Moves into another part of the window are announced. Move Editor to Part… editorDropTarget.test.ts, viewEditor.test.ts, editorPartActions.test.ts
P14 47f173fb126 D3 A part drags by a grabber on the top edge of its card (on hover). Drop indicator: within 16px of a window edge → that edge; else beside the part under the pointer; onto itself → nothing. Parts in the grid ignore part drags. Move Part Left/Right/Up/Down (past parts only, never past chrome such as the title row) partGrid.test.ts
P15 c137c7168b1 D4 An editor dropped on a window edge, outside the parts, goes into a new part there, created by the owner's IPartGridPartFactory; parts the grid created close with their last editor (also after restore). Move Editor into New Part Left/Right/Above/Below. PartGrid takes IEditorGroupsService. partGrid.test.ts
P15b 0d6a8555e53 ChatWindowPartFactory (parts like the window's main part, closed with the window); ChatWindowGrid gives it to every grid it arranges and keeps created parts across layout-mode rebuilds chatWindowPartFactory.test.ts, chatWindowGrid.test.ts
P16 a0f4f6e25cb D5 A chat tab, a chat or session row of the sessions list, or the main window's session header dragged out of the windows opens the chat in a chat window at the drop point (IChatWindowOpenOptions.bounds), with the main window's editors as with Open in New Window. The chat in a chat window drags by its session title. The chat view registers as content that handles drops. Shared getNewWindowBoundsAtDragEnd (tab drag-out unchanged). dnd.test.ts, chatWindowDragOut.test.ts, chatCompositeBar.test.ts, sessionsListChatMoveDnd.test.ts

Review fixes (additive fixup! commits)

Commit Fixes
14ecffab4b8 (P13) The view editor's drag handle no longer stops propagation, so the session header adds its session/chat drag data (dragging the header title onto the sessions list or into a chat input works again).
53f0f1e4770 (P15) Window-edge drops (D4) are decided by the distance to the window edge before card targets, so the top edge and the compact look work; inner drop overlays are disposed.
5e2c3af3481 (P15b) The chat window tracks the chat editor in every group of its window: moving the chat into a created part or the Terminals part keeps it in the window. The window shows only its chat when the main part empties only while the chat is in the chat part.
a0f4f6e25cb + 8a377b6e8ea (P16) D5 follows workbench.editor.dragToOpenWindow and the Alt toggle, and only when nothing took the drop; only from the main Agents window. Move Part / Move Editor into New Part announce when there is no part to act on.
bf07890aa78 (P16) The window's title row shows whenever the chat doesn't lead the window (IChatWindow.chatLeads: in the chat part, no part to its left or above it), so the title and window controls never travel with a chat moved into another part or dragged after another part. Window edges (D4, Move Part to an edge) are the edges of the parts: the title row keeps spanning the window.
2071f44b610 + 08f236b9da1 (P15) D4 and part-drag window edges are those of the parts: below the title row (an OS drag region across the top of the window, which gets no drag events) and including the outer insets.
cf136053d58 + 27b581d34bb (P13) QA BUG-5: over the chat, the edge overlay shows for the drag that creates it and that drag doesn't reach the chat, so the chat doesn't show "Attach File as Context" there. An overlay that shows always takes its drop, even before any drag moved over it.
13bf9a9259e (P14) QA BUG-8: Move Part to an edge the part is already at leaves the parts, their sizes and the focus as they are (and announces "already there").
81372db67cb (P16) The chat leads the window only from the first group of the chat part: with a group split off to its left (D2), the window's title row shows.
8a343752af0 (P15b) A part the grid creates or closes (D4, Move Editor into New Part) keeps the arrangement the window's, so Block 2 remembers its part sizes, unless something else, such as a part move, changed the arrangement first.
f7e2606529d (P15) Removed the now-unused { part, view } cell shape (the chat is a plain part cell since Block 2's title-model rework).
57ba275f069 (P14) QA final FAIL #1: Move Part keeps the sizes of the other parts and the moved part takes the rest, so moving it back restores the layout (e.g. terminals stay 72px).
92d680f4efb + f67c537db04 (P16) QA final FAIL #4: the groups of the chat part besides the chat's (an editor split into the chat part, D1a) are stored with the window (IChatWindowOpenOptions.chatPart: the part's state and the chat's group) and restored in place, with the chat back in its own group; a stored group the part no longer has falls back to the active group, and a stored value that is not one is ignored.
bd4c5b7fb72 + 350ed6625ff (P15b) Grid tests from the base pass the part factory and the editor groups service.
0b69ddc7ae3 (P15) + 5f0806d0bc8 + af45dac30d7 (P15b) A new part takes its room from the part the editors come from (window-edge drops), and on a rearrangement from the main part, else the chat: the terminals and the other parts keep their sizes (e.g. terminals at 199 across Move Editor into New Part and edge drops).
225a858b86c (P15) + eb2fb602b39 (P15b) The cells of created parts are marked (data-part-grid-created), and the chat window look frames them like the main part, so their cards line up with it (no 1px offset).
d148a5169d2 (P13) The view-editor drop test aims at the view rather than its group, which the browser runner lays out taller than the view.
split-part card (P15 + P15b fixups) A part split into more than one group is marked (data-part-grid-split) and, in a chat window, is one card: the card frames its groups once, the editor part divides them, and the groups and the chat in them draw no frames of their own (user decision; the main window is unchanged). Verified live.
3686a485063 (P14) + edb53e5eb4f (P15b) Card drag and drop (user decision): a card dropped beside another shows its whole slot after the move (a dry run of the same move), with the card look; dropped on the center of another card it merges into it (its editors join that card), the whole target highlighted. No half-card overlay for card drags (editor/tab drags unchanged). Chat windows do not merge (setMergeAllowed(false)), so only place-next-to is offered there. Verified live: previews match the drop exactly.
f1355f5357f + 062b02a20b9 + 2cee0046cf6 (P14) Card glide (user decision): (superseded by the pointer-driven card motion below, which keeps the glide on Move Part) every part move (a drop, the Move Part commands) glides from where the cards were to where they are, one FLIP per move (160ms, ease-out), transforms and clip-path only. Real cards move with their content; cards with native/overlay content (integrated browser, canvases, webviews, notebooks) move as plain cards, under which integrated browsers give way (part-grid-motion in browserView's overlay list). Without .monaco-enable-motion (reduced motion) moves are instant. While a card is dragged nothing moves: the static slot preview shows where it goes, its dry run once per place, not per dragover (live: median 0.1ms per dragover). Verified live.
5507623f952 + 504b7e18045 (P14) The empty space of the title of a group that is not at the top edge of the window (no part-grid-top-edge-group, Block 2's marker; at the top edge the title moves the window) drags its part, as the drag handle does: registerPartTitleDrag takes the drag in the capture phase before the group does. Tabs still drag their editors. A lower group of a split card has no marker, so its title space drags the card too (user decision: every title row of a card is its handle). Verified live with real mouse drags, a created part and the terminals.
a237265aa35 (P15b) Reset Chat Window Layout (Block 2): ChatWindowGrid.reset() first closes the parts the grid created, their editors moving into the main part (moveEditorsToChatWindow), so the window is arranged as the mode arranges it.
card motion (P14 + P15b fixups from the card motion chat) Card drags are pointer-driven (they replace the HTML5 part drag): the card lifts (0.6 scale) and follows the pointer, the other cards reflow once per target (PartGridReflow), drop zones are by card centre and window edges by pointer, and the drop commits once after the settle. The grabber and the empty title space of a group not at the top edge (getPartTitleDragSource) start it via PartGrid.startPartDrag(id, e). Merge (whole-target highlight) where allowed, including chat windows; editor drags get new-part zones at the window edges.
5f1a661f5a3 (P15b) The chat's editor is found in every group of the window (windowGroups, so also in created parts): merged into a created part it still closes the window, moves out of it, and returns to the chat part before a layout command (_findChatGroup, _returnChat).
b756f352bd3 (P14) U13: terminals merged into a chat window's main part stay there. ChatWindowTerminals moved every terminal editor that opened in the main part to the terminals part; it now moves only new terminals (an editor moved from another group is still in that group as it opens).
U15 (card motion) + 4cafae9b298 (P13) Rebased onto main (d45a10c) via Block 2. editorDropTarget sits on main's input drop targets (7525d70): inputs take drops through the holes the overlay's clip-path leaves over them, and a drag entering one gets no overlay (groups excepted); the overlay's own input checks are gone, and the rule that editors/groups split over a chat is unchanged.
054af735586 (P13) QA: an edge split over a chat beside a group at its minimum size squeezed the chat (the part expanded the new group, as the chat's group counted as expanded). A split over content that handles drops now gives the new group half of the group, as the drop indicator shows. Test with a real editor part in viewEditor.test.
full review of c5df398a36f (fix-first) M1 (P15): a cross-window editor drag that ends in its own window, such as cancelled with Escape there, no longer leaves the new part's slot and reflowed cards: the drop target listens for drag ends in every registered window, and resets on a leave once no editors are dragged. M2 (P15b): parts a chat window created are stored with their editors and restored as it restores (see Decisions). M3 (P14, P15b): PartGrid.setPreviewLayoutAllowed; in chat windows the terminals part and parts whose active editor is a terminal only clip while cards make way, so PTYs don't resize during previews or on cancel. M4 (P14, P15): a drop that still settles is dropped when the grid disposes (no part created); a new drag still settles the previous one. M5 (P15b): no merging into the terminals part, as for the chat. L1 blur cancels a card drag. L2 new-part zones follow splitOnDragAndDrop and its toggle key, and the copy key copies. L3 Move Part restores the other sizes inside the glide. L4 created parts are named Editor 2, Editor 3, …. L5 commands also need editorPartInPartGrid. L6 the overlay anchor registry keeps the hidden count across re-anchoring (base tests). L7 the grabber's hit area stops at its grip.

Decisions

  • Part drag handle: the card's top edge only (user decision). No modifier on the title area: Alt already means copy / no-new-window on tab and group drags.
  • The chat drags by its session title only. In a chat window the header sits in the title bar, whose empty space moves the OS window (-webkit-app-region: drag); that keeps working, and the title (no-drag) drags the chat.
  • The layout mode resets part moves (user decision): a D3 move lasts until the next layout-mode change, which arranges the window again. Parts created by D4 stay across layout-mode changes until they close.
  • Webviews don't reload on part moves: webviews render in an overlay, not inside the part's DOM (verified live).
  • Q10: a chat window ignores chat drops (its session is scoped to its chat). Q9 (the chat editor moved into another window) is Block 2's chat window behaviour.
  • Created parts restore with their editors, at the window edge (M2): each part a chat window created is stored with its editors and, as the window restores, its editors move into a new part at the edge where created parts go when the window's parts are arranged (as after a layout-mode change, which also re-arranges them). Exact positions/sizes are not stored: the arrangement re-derives them, as the layout mode does. Where a window creates no parts, the editors stay in its main part.

Validation

Run on this branch, on Block 2 4db00ac8c50: typecheck, ESLint, the partGrid and chatWindow suites and browserView's overlayManager.test (7 passing) on 0969de721cd; the others on edb53e5eb4f (later changes touch only PartGrid, its CSS and the browser overlay list).

Command Result
pnpm run typecheck-client passed, 0 errors
pnpm run eslint on every .ts file the branch changes passed
node test/unit/browser/index.js --browser chromium --runList <every test file the branch changes> 228 passing
hygiene (pre-commit hook on every commit) passed
./scripts/test.sh --runGlob "vs/workbench/test/browser/parts/editor/**/*.test.js" 373 passing
./scripts/test.sh --runGlob "vs/workbench/test/browser/parts/partGrid/**/*.test.js" 51 passing
./scripts/test.sh --runGlob "vs/workbench/test/browser/dnd.test.js" 2 passing
./scripts/test.sh --runGlob "vs/workbench/services/editor/test/browser/**/*.test.js" 271 passing
./scripts/test.sh --runGlob "vs/sessions/test/browser/**/*.test.js" 666 passing
./scripts/test.sh --runGlob "vs/sessions/contrib/sessions/test/browser/**/*.test.js" 1132 passing
./scripts/test.sh --runGlob "vs/{workbench,sessions}/contrib/chatWindow/test/**/*.test.js" 153 passing

Live validation (§7.3)

Agents window from this worktree (build-fast), isolated copy of an authenticated profile, sessions.chatWindows.enabled: true, driven over CDP. The second run used realistic focus (document.hasFocus false in the window not in front).

Check Result
D5 from a sessions-list session row, cursor outside the windows chat window opened at the drop point (y = cursor; x clamped to the display)
D5 with the cursor over the focused window nothing opens (unchanged)
D5 from the main window's session header chat window opened
D1/D2: an editor dragged from the main window onto the chat part's edge the chat part split, the editor in the new group; the chat's group keeps no tab
D1: the chat dragged by its session title into another group moved (not copied), conversation intact
D1: an editor tab over the chat's conversation no editor overlay; the chat's own drop overlay shows
D1: an editor tab dropped on the chat input attached to the chat (chip)
D4: an editor dropped on the window's right edge, outside the cards indicator on the right quarter; new part at the right with the editor
D3: a part's grabber dragged onto the left of the chat indicator on the chat's left half, no editor overlay; part moved left of the chat
Move Part Right the part moved past the chat
Move Editor into New Part Right new part with the editor; the emptied created part closed
Move Editor to Part… quick pick of the window's parts ("Editor (readme.md)", "Chat"); editor moved into the main part
Part move with a Markdown Editor webview 0 iframe loads, same iframe (no reload)

Found live and fixed in this PR: editor drops onto the chat input split the part (now the input's); the part factory created its element in the child window's JavaScript context (now in the main window's, attached to the chat window); Move Part could move past the title row (now parts only).

@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.146.0 milestone Nov 2, 2026
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/parts-drag-and-drop branch 3 times, most recently from 79d32fe to 26d271e Compare November 2, 2026 23:44
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/parts-drag-and-drop branch 2 times, most recently from d28b137 to 9c2b93f Compare November 3, 2026 00:53
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/parts-drag-and-drop branch 7 times, most recently from 079afc3 to 9e08a62 Compare November 3, 2026 12:05
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/parts-drag-and-drop branch 3 times, most recently from 504b7e1 to a237265 Compare November 3, 2026 16:38
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/chat-windows-on-parts branch 2 times, most recently from b75e29c to e9e3144 Compare November 3, 2026 17:42
@sandy081
Sandeep Somavarapu (sandy081) force-pushed the agents/parts-drag-and-drop branch 2 times, most recently from 4cafae9 to 5fcf3d4 Compare November 3, 2026 22:59
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

Terminals merged into a chat window's main part stay there (U13): ChatWindowTerminals moved every terminal editor that opened in the main part to the terminals part, which put merged terminals back. It now moves only new terminals: an editor that moves from another group is still in that group as it opens.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

Editors dragged where they go into a new part stay there until the pointer leaves the grid: Chromium tells no related target as what is under the pointer changes, which it does as the cards make way.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

The cards that make way are laid out for real where they go, not only moved and clipped: as one starts to slide, it is laid out as large as where it was and where it goes, so that what it shows fills the card as the card's clip slides from size to size, and once it slid, exactly where it goes. A target change lays them out, not a frame. Leaving, Escape and the drop lay them out as the grid does.

Co-authored-by: Copilot <[email protected]>
… dropped on their edges

A part dropped on the center of the chat goes beside it, on its nearest side, rather than merging: its editors would join the chat's group, whose title is the chat's own. The parts of a grid say which merge with a predicate (`PartGrid.setMergeAllowed`), the chat window that none merges into the chat; the chat merging into another part still does.

Co-authored-by: Copilot <[email protected]>
…er views that handle drops

Editors and groups dragged over a view that handles drops, such as a chat, cannot go into its group, where they would be behind it: they split the group on the side nearest to them, also over its center, into a new group with its own tab row. The view's inputs still take them, and other drags, such as files, still go to the view.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

Over the center of a part it merges into, the cards stay as they are as the card lifted, its slot where it was, and only the part it merges into is highlighted, in its frame: what the merge changes shows once it is done. Moving beside a part, the cards make way; back over the center, they are as they were again. Dropped, the card settles into the part, then the part merges once, and the cards glide to where that leaves them.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

While cards move, a part whose editor draws over the window rather than in it, such as a webview, a notebook, an integrated browser or a canvas, shows a placeholder for it: the content drawn over it hides, its tabs move and lay out with its card, and over the editor shows the watermark of an empty editor with the editor's icon and name. What draws over an element registers it as an overlay anchor (`registerOverlayAnchor`), as overlays positioned over elements and native web contents views do, so that the grid finds and hides it without knowing what it is. The content shows again once the cards settled.

Co-authored-by: Copilot <[email protected]>
…er views that handle drops

fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops

On main's input drop targets (7525d70): inputs take drops through the holes the overlay's clip-path leaves over them, and a drag that enters one creates no overlay, except for groups. The overlay no longer checks for inputs itself; content that handles drops still lets only editors and groups split the group. The test asserts the hole rather than a synthetic drag over the overlay, which ignores clip-path.

Co-authored-by: Copilot <[email protected]>
…er views that handle drops

fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops

An edge split over content that handles drops, such as a chat, gives the new group half of the group, as the drop indicator shows. Beside a group at its minimum size the group counted as expanded, and the part expanded the new group, squeezing the chat to its input.

Co-authored-by: Copilot <[email protected]>
…w goes into a new part

fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part

The look test from the base passes the editor groups service.

Co-authored-by: Copilot <[email protected]>
…w goes into a new part

fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part

M1: a drag of editors from another window that ends there, such as cancelled with Escape there, no longer leaves the new part's slot and the cards that made way for it: the drop target listens for drag ends in every window, and a leave once no editors are dragged resets it.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

M3: PartGrid.setPreviewLayoutAllowed: a window can say which parts do not lay out at the sizes their cards take while cards make way, such as those showing terminals, whose processes resize, also for a drag that is cancelled. Their cards only show clipped until the grid lays them out.

Co-authored-by: Copilot <[email protected]>
… dropped on their edges

fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges

M5: a part does not merge into the terminals, whose groups stay locked to terminals. M3: terminals, the terminals part or a part whose active editor is a terminal, do not lay out while cards make way.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

M4: a card drag disposed while its drop still settles, such as with its grid, drops it; a new drag still settles the previous one first. L1: the window losing focus cancels a card drag.

Co-authored-by: Copilot <[email protected]>
…w goes into a new part

fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part

M4: disposed while editors dropped into a new part still settle, such as with its grid, the drop is dropped: no part is created.

Co-authored-by: Copilot <[email protected]>
… dropped on their edges

fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges

M2: the parts a chat window created, such as for editors dropped on its edges, are stored with their editors and open again as it restores: each part's editors move into a new part at the edge of the window, where such parts go as its parts are arranged (as after a layout-mode change). Where the window creates no parts, their editors stay in its main part.

Co-authored-by: Copilot <[email protected]>
…w goes into a new part

fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part

L2: editors go into new parts as the editor groups split: only while workbench.editor.splitOnDragAndDrop, as toggled by its key, and the copy key copies them into the new part.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

L3: Move Part restores the sizes of the other cells inside the change that glides, so that the cards glide to where they end up.

Co-authored-by: Copilot <[email protected]>
… dropped on their edges

fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges

L4: the parts a chat window creates are named apart from its main part, Editor, and from each other: Editor 2, Editor 3, for announcements and Move Editor to Part.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

L5: the parts of a part grid say so in their context (editorPartInPartGrid, generic, not chat-window only), and Move Part needs it besides the Agents window.

Co-authored-by: Copilot <[email protected]>
…w goes into a new part

fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part

L5: Move Editor into New Part needs the part to be one of a part grid.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

L6: the overlay anchor registry is keyed by host: a host registered again, such as an overlay re-anchored mid-drag, keeps its hidden count, so it does not show again while hidden; one disposed while hidden shows again. Tests for the registry.

Co-authored-by: Copilot <[email protected]>
…Move Part commands

fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands

L7: the grabber takes the pointer only down to its grip, not over the tabs under it.

Co-authored-by: Copilot <[email protected]>
… dropped on their edges

fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges

Closing the window closes its main part first (#345683).

Co-authored-by: Copilot <[email protected]>
@sandy081
Sandeep Somavarapu (sandy081) merged commit eb200c4 into agents/chat-windows-on-parts Nov 4, 2026
2 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the agents/parts-drag-and-drop branch November 4, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant