Skip to content

sessions: extend sessions list drag and drop across placements - #342591

Merged
Benjamin Christopher Simmonds (benibenj) merged 5 commits into
mainfrom
benibenj/agents/drag-drop-session-grouping-improvements
Oct 19, 2026
Merged

Benjamin Christopher Simmonds (benibenj) merged 5 commits into
mainfrom
benibenj/agents/drag-drop-session-grouping-improvements

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Extends drag and drop in the Agents window Sessions list so that sessions can be moved between all list placements, not only into groups and Pinned.

What changed

Every session drop now resolves to a destination placement: Pinned, a custom group, the session's own ungrouped section (workspace, Recent/Older, Chats, External), or Archived, plus an optional anchor row. A single move function then applies only the state that the list's placement precedence (archived > pinned > group > section) needs: archive or unarchive, pin or unpin, join or leave a group, and the manual sort key. Adding a drop target is one more case that maps the hovered element to a destination. Adding a placement is one more entry in getPlacementState.

New behaviors:

  • Out of a group into date sections: grouped sessions can be dragged back into Recent/Older (and grouped quick chats back into Chats).
  • Unpin by dragging: drop a pinned session on its own section or between that section's sessions.
  • Archive / unarchive by dragging: dropping on the archived section archives the sessions with the existing "N archived · Undo" notification, through a new internal sessionsViewPane.archiveSessionsWithUndo command. Archived sessions dropped on a section, group, or Pinned are restored first.
  • Date header drops: dropping on Recent or Older places sessions at the top of that section. When the gap crosses the Recent/Older boundary, keys stay next to the anchor so the session lands in the highlighted section.
  • Drop on empty space (date grouping): sessions go to the end of the date sections. Archived sessions are refused.
  • Chat rows: nested chats can be reordered within their session. This stores a new persisted, list-owned chat order per sort mode in ISessionsListModelService; chats missing from the order keep their natural position. Dropping a session on a chat row places it after that chat's session.

Side effects: comparison groups are no longer offered as targets for membership changes (those drops used to look valid but do nothing). Reorder neighbours now come from all sessions in the anchor's sort scope instead of only visible rows, so drops also work against collapsed sections.

SESSIONS_LIST.md is updated because the drag-and-drop contract and the persisted list state changed.

How to test

In the Agents window Sessions list:

  1. Group by date. Drag a session out of a custom group onto a Recent/Older row, onto the Older header, and below the last row.
  2. Drag a pinned session onto its own section, and drag a session onto the Done/Archived header (check Undo).
  3. With archived sessions shown, drag an archived session onto Recent.
  4. Expand a session with nested chats, reorder them, and switch sort modes.

Validation

  • tsc type check of the changed files: no errors in src/vs/sessions (run with the main checkout's TypeScript because this worktree's node_modules could not be reinstalled).
  • Unit tests in src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts were added and updated but not run locally; CI will run them.
  • ESLint was not run locally.
  • The chat reorder has no keyboard equivalent yet; the other moves already have context-menu actions.

Resolve every session drop to a destination placement (Pinned, a custom group, an ungrouped section, or Archived) and apply only the archive, pin, and group changes that placement precedence needs. This lets sessions be dragged out of groups into date sections, unpinned, archived (with undo) and restored by dragging, placed at the top of a date section via its header, and moved to the end of the date sections by dropping below the last row. Nested chats can be reordered within their session through a new persisted, list-owned chat order, and dropping a session on a chat row places it after that chat's session.

Co-authored-by: Copilot <[email protected]>
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Sandeep Somavarapu (@sandy081)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsListModelService.ts

Ladislau Szomoru (@lszomoru)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsListModelService.ts

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

Placement correctness, selection ordering, and keyboard accessibility remain unresolved.

4 open issues
What changed in this PR

Extends Agents window Sessions list drag and drop across placements and adds persisted nested-chat ordering.

Changes:

  • Unifies session moves between pinned, grouped, ungrouped, and archived placements.
  • Adds nested-chat reordering per sort mode and archive-with-undo integration.
  • Updates tests and the list’s documented behavior.
File Description
src/​vs/​sessions/​SESSIONS_LIST.md Documents placement and chat-order contracts.
src/​vs/​sessions/​services/​sessions/​browser/​sessionsListModelService.ts Persists per-sort nested-chat order.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListTestUtils.ts Extends drag-and-drop test helpers.
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsList.test.ts Adds placement and chat-reordering tests.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsViewActions.ts Registers archive-with-undo command.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsList.ts Implements destination-based moves and chat ordering.
src/​vs/​sessions/​common/​sessionCommands.ts Defines the archive-with-undo command identifier.

Review effort: Balanced

roblourens
roblourens previously approved these changes Oct 19, 2026
Add keyboard Move Up/Move Down actions for nested chats that keep focus on the moved chat. Anchor drops below the last row in an earlier date section when the selection empties the last one, preserve the dragged sessions' display order, and only offer date section drops when date grouping will render the sessions in that section.

Co-authored-by: Copilot <[email protected]>
…drop-session-grouping-improvements

Combine the placement-based session drops with moving chats and sessions by drag and drop (#342624): provider moves take precedence for chats and single sessions the provider can move, and the list's own placement handles everything else. The provider owns the order of chats it can move, so a provider move clears the list-owned chat order of the sessions involved, and Move Up/Move Down reorder movable chats through the provider like dragging does.

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

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: c2f7817f Current: 2efad147

Changed (1)

sessions/sessionsList/SessionsList_ArchivedNestedChatMenu/Light
Before After
before after

#342682 and #342706 both added the IDefaultAccountService import and stub to the Connector authorization test fixture, so main no longer compiles (duplicate identifier). Keep a single copy.

Co-authored-by: Copilot <[email protected]>
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit fe9ee64 into main Oct 19, 2026
49 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/agents/drag-drop-session-grouping-improvements branch October 19, 2026 23:54
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 19, 2026
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Oct 20, 2026
…n the list (#342849)

The sessions list kept its own order of a session's nested chats (#342591) next to the order the sessions provider owns. Chats the provider could not move were reordered in the list-owned order, and every provider move then cleared it, so earlier arrangements snapped back. Provider moves were also anchored in the provider's order while the rows showed the list-owned one.

Nested chats now render in the provider's order only. A nested chat its provider can't move is not accepted as a drop, Move Up and Move Down are available only for chats the provider can move, and the persisted sessionsListControl.chatOrder key is removed on startup.

Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Oct 20, 2026
…on (#343025)

Adds a regression test for #340740: a quick chat moved into a custom
group can be dragged back onto the Chats section header even when it is
the only quick chat, so Chats is empty and renders its placeholder.

The drop target itself was fixed by #342591, which resolves drops to
placements and lets quick chats return to Chats; its test only covered
a populated Chats section.

Fixes #340740

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.

4 participants