Skip to content

sessions: reveal the side pane when opening Changes after collapsing it#323345

Merged
sandy081 merged 1 commit into
mainfrom
sandy081/fix-auxbar-reveal-after-collapse
Jun 28, 2026
Merged

sessions: reveal the side pane when opening Changes after collapsing it#323345
sandy081 merged 1 commit into
mainfrom
sandy081/fix-auxbar-reveal-after-collapse

Conversation

@sandy081

Copy link
Copy Markdown
Member

What

In the Agents window, the per-session layout controller did not re-reveal the auxiliary bar when opening a Changes editor after the whole side pane had been collapsed and the window reloaded.

This tracks a new per-session auxiliaryBarHiddenByCollapse bit so a collapse-driven aux-bar hide is distinguished from an explicit aux-bar hide:

  • Collapse (D9): closing the whole side pane (editor + aux bar) via the toggle hides the aux bar as a side effect. The side pane is still restored closed on reload, but opening a Changes editor re-reveals the aux bar.
  • Explicit hide: hiding just the aux bar (editor stays open) is remembered and is not re-revealed when a Changes editor opens.

It also gates the reveal on the editor part being visible, so a Changes editor restored on reload (which becomes the active editor while the editor part is still hidden) does not auto-reveal the side pane; only a user-opened Changes editor (which reveals the editor part first) does.

Why

Repro (Agents window):

  1. Open a session, click Changes (editor + aux bar visible), open the sessions list (all four parts visible).
  2. Toggle the side pane closed (hides editor + aux bar).
  3. Reload the window.
  4. Click Open Changes → previously only the editor part opened, the aux bar (Changes view) stayed closed.

Root cause: the live aux-bar capture correctly skips a whole-pane toggle, but the save-time capture (switch-away / shutdown) re-read the now-hidden aux bar and persisted auxiliaryBarVisible: false. After reload, _revealChangesViewOnFirstOpen treated that as an explicit hide and never revealed.

Notes for reviewers

  • The persisted auxiliaryBarHiddenByCollapse flag is only written when true (omitted otherwise) to keep stored state minimal and existing entries unchanged.
  • The flag is cleared when the side pane is re-opened, on a session switch, and when the [D2] listener records a genuine aux-bar change.
  • Two focused unit tests added in desktopSessionLayoutController.test.ts:
    • [D9] does not auto-reveal the side pane when the Changes editor is restored on reload (editor part hidden → no reveal).
    • [D9] reveals the Changes view when opening Changes after reloading a session whose side pane was toggled closed (editor part visible → reveal).
  • Spec desktopSessionLayoutController.md (D8/D9) updated.

Depends conceptually on the editor-part restore fix in #323342 (which is what makes the editor part open at all after reload), but is independent in code.

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

In the Agents window, collapsing the whole side pane (editor + auxiliary bar)
via the toggle hides the aux bar as a side effect, not as an explicit aux-bar
choice. The live capture skips it, but the save-time capture (switch-away /
shutdown) re-read the now-hidden aux bar and persisted auxiliaryBarVisible:false.
After a reload, opening the Changes editor then revealed only the editor part,
not the aux bar.

Track a per-session auxiliaryBarHiddenByCollapse bit so a collapse-driven hide is
distinguished from an explicit aux-bar hide: the side pane is still restored
closed on reload, but opening a Changes editor re-reveals the aux bar. An explicit
aux-bar-only hide stays remembered and is not re-revealed.

Also gate the reveal on the editor part being visible: a Changes editor restored
on reload becomes the active editor while the editor part is still hidden, which
must not auto-reveal the side pane; a user-opened Changes editor reveals the part
first.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 28, 2026 15:03
@sandy081 sandy081 self-assigned this Jun 28, 2026
@sandy081 sandy081 enabled auto-merge (squash) June 28, 2026 15:03
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@benibenj

Matched files:

  • src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.ts
  • src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.md
  • src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.ts
  • src/vs/sessions/contrib/layout/test/browser/desktopSessionLayoutController.test.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.

Pull request overview

This PR updates the Agents window per-session layout persistence so that collapsing the whole side pane (editor + auxiliary bar) is distinguished from an explicit auxiliary-bar hide, allowing Changes to re-reveal the auxiliary bar after reload when appropriate, while avoiding auto-reveal during restore when the editor part is still hidden.

Changes:

  • Persist a per-session auxiliaryBarHiddenByCollapse marker to distinguish collapse-driven aux-bar hides from explicit hides.
  • Gate the “reveal Changes view on first open” behavior on the editor part being visible to avoid auto-reveals during working set restore on reload.
  • Add unit tests covering the reload/restore vs user-open distinction and update the design spec.
Show a summary per file
File Description
src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.ts Tracks whether the whole side pane is currently collapsed via toggleSidePane().
src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.ts Persists/consumes auxiliaryBarHiddenByCollapse and gates Changes-view reveal on editor-part visibility.
src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.md Updates D8/D9 spec to describe collapse-vs-explicit-hide behavior (including across reload).
src/vs/sessions/contrib/layout/test/browser/desktopSessionLayoutController.test.ts Adds focused regression tests for reload restore vs user-open behavior.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Low

@sandy081 sandy081 merged commit d9dad90 into main Jun 28, 2026
30 checks passed
@sandy081 sandy081 deleted the sandy081/fix-auxbar-reveal-after-collapse branch June 28, 2026 19:04
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 28, 2026
sandy081 added a commit that referenced this pull request Jun 28, 2026
#323360)

* sessions: scope the side-pane collapse marker to the collapsed session

Address Copilot code review on #323345: deriving auxiliaryBarHiddenByCollapse
from a controller-global _sidePaneToggledClosed flag read at arbitrary capture
times was leaky. It required resetting the flag on session switch (breaking the
documented invariant) and could still clobber an explicit aux-bar hide on a
different session, turning it into a collapse.

Record the collapse marker for the active session directly in _onSidePaneToggled
(where the collapse actually happens), and have _captureViewState only preserve
an existing marker while the aux bar stays hidden — never fabricate one. The
global flag is no longer read anywhere, so remove it along with the
session-switch and aux-bar-change resets.

Add a regression test asserting an explicit aux-bar hide is not turned into a
collapse when another session is collapsed.

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

* sessions: only mark a collapse when it hides a previously-visible aux bar

Address Copilot code review on #323360: _onSidePaneToggled set the collapse
marker whenever the aux bar ended up hidden after a toggle. But re-opening the
side pane can restore an editor-only state (aux bar explicitly hidden before the
collapse), which wrongly stamped that explicit hide as collapse-driven and made
opening Changes re-reveal the aux bar.

Pass collapsed + previousAuxiliaryBarVisible to the hook and only mark the
collapse when the toggle fully collapsed a previously-visible aux bar; any other
outcome captures the resulting state without fabricating a marker, preserving an
explicit aux-bar hide.

Add a regression test for the collapse + editor-only re-open case.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants