[FEATURE] Sidebar: option to hide sessions already open in an editor group
Preflight
- Searched existing
enhancementrequests, this hasn't been requested (closest is #71710, which is about sessions being lost when switching folders, a different problem). - Single feature request.
Problem Statement
I usually have a lot of chats open at once across editor groups (several worktrees, a few agents running). Every one of those open chats also shows in the sidebar session list, so the list is full of the sessions I'm already looking at. When I want to jump to a session I haven't opened yet, I have to scan past everything already on screen to find it. The list would be much easier to navigate if it only showed what's left to open.
Proposed Solution
An off-by-default setting, e.g. claudeCode.hideOpenSessionsInList, that hides a session from the sidebar list while it has a live editor tab open. Off by default so nothing changes for anyone who doesn't opt in. Closing the tab brings the session back into the list.
Why this is harder than it looks (and how I'd suggest implementing it)
I tried to hack this together locally by filtering the list against the extension's live panel map, and it only half-works, which turns out to be a real VS Code limitation rather than a bug. Writing it down so whoever picks this up doesn't hit the same wall:
- Hidden tabs restore lazily. After a window reload,
deserializeWebviewPanelonly fires when a panel first becomes visible (webview docs). Background chat tabs stay as title-only placeholders until clicked, so their session id isn't known to the extension yet. A filter based on live panels therefore hides the foreground sessions and leaves the backgrounded ones, which is the opposite of useful.
- Webview tabs have no identity.
TabInputWebviewexposes onlyviewType, no id and no uri (microsoft/vscode#319242, #201884), so you can't enumeratewindow.tabGroupsand map a tab back to its session. Custom editors get a uri viaTabInputCustom; webview panels don't.
Because of those two, the only complete source of "which sessions are open" is the persisted workbench editor state on disk, which isn't something an extension should be reading live.
The clean way to do it from inside the extension: persist an open-session-id set in workspaceState, updated when a panel is created and when it's closed, and reconcile it against window.tabGroups.onDidChangeTabs. That set survives a reload because it was written while the tabs were still open, so you don't need the background webviews to boot to know they're open. The reconciliation on tab-close handles the case where a backgrounded tab is closed without ever being focused. This is doable here because the extension owns the panel lifecycle and the serializer; it isn't doable from outside.
Alternative / related
- Manual hide (the trash icon) is permanent and per-session, so it doesn't fit "temporarily de-clutter what's already open."
- #75126 (folder/group organization for the session list) would solve the same underlying pain, a navigable list, and sidesteps the identity problem entirely, since grouping doesn't require knowing a session is open. Either of these would help; this one is the lighter-weight version.
Priority
Low - Nice to have
Feature Category
Configuration and settings
Use Case Example
- I open 6 or 7 chats across different groups while working across a few worktrees.
- I want to resume a different, older session I haven't opened this run.
- The sidebar list is mostly the chats already visible in my tabs.
- With the toggle on, the list shows only the sessions not currently open, so the one I want is right there instead of buried.