Skip to content

sessions: move Create Pull Request bar to the editor tabs title#325122

Draft
sandy081 wants to merge 1 commit into
mainfrom
sandy081/create-pr-editor-tabs-title
Draft

sessions: move Create Pull Request bar to the editor tabs title#325122
sandy081 wants to merge 1 commit into
mainfrom
sandy081/create-pr-editor-tabs-title

Conversation

@sandy081

@sandy081 sandy081 commented Jul 9, 2026

Copy link
Copy Markdown
Member

What

Moves the Changes Create Pull Request button bar (ChangesActionsBar) into the single-pane editor tabs title (the editor-actions area of the docked tab bar, Menus.SessionsEditorTitle) instead of hosting it in the session title bar. Also makes the bar collapse its labelled buttons to icon-only when the tabs title gets narrow.

Why

In the single-pane layout the Create Pull Request action fits more naturally alongside the docked Changes editor's tab bar than in the session title bar, and it needs to yield horizontal room to the tabs when space is tight.

Changes

  • Anchor action moved to the editor tabs titleCHANGES_HEADER_ACTIONS_ID is now contributed to Menus.SessionsEditorTitle (navigation, order 5), gated on the Changes editor being active in single-pane (singlePaneChangesEditorTitle) + SessionHasChangesContext, replacing the previous Menus.TitleBarSessionMenu hosting.
  • Custom action view item provided by the editor paneSessionChangesEditor.getActionViewItem returns ChangesActionsBarActionViewItem for CHANGES_HEADER_ACTIONS_ID in single-pane, so the group's editor-actions toolbar renders the bar (that toolbar resolves custom items via the active editor pane, not IActionViewItemService).
  • Icon-only collapse when narrow — a ResizeObserver on the tab-bar ancestor drives a compact observable that both button-bar widgets (ChangesMenuWorkbenchButtonBarWidget for git/Copilot CLI, ChangesWorkbenchButtonBarWidget for agent-host) read to strip button labels below CHANGES_ACTIONS_BAR_COMPACT_WIDTH, freeing room for tabs. The observer retries across a few animation frames while the toolbar attaches and falls back to .editor-group-container when there is no .tabs-and-actions-container.
  • CSS — updated ChangesActionsBar comments/scoping for the editor tabs title host; the classic internal changes-editor header path is unchanged (passes constObservable(false) for compact).

Notes for reviewers

  • The classic (non-single-pane) internal changes-editor header still renders the same ChangesActionsBar and does not collapse (no tab-bar ancestor to observe).
  • The compact-width threshold (CHANGES_ACTIONS_BAR_COMPACT_WIDTH = 500) may need calibration against real tab-bar widths.

Host the Changes 'Create Pull Request' button bar (ChangesActionsBar) in
the single-pane editor tabs title (the editor-actions area of the docked
tab bar, Menus.SessionsEditorTitle) instead of the session title bar.

- Contribute the CHANGES_HEADER_ACTIONS_ID anchor action to
  Menus.SessionsEditorTitle, gated on the Changes editor being active in
  single-pane (singlePaneChangesEditorTitle) + SessionHasChangesContext.
- Provide the custom action view item (ChangesActionsBarActionViewItem)
  from SessionChangesEditor.getActionViewItem so the group's editor-actions
  toolbar renders it.
- Collapse the button labels to icon-only when the tabs title is narrow: a
  ResizeObserver on the tab-bar ancestor drives a compact observable that
  the button-bar widgets read to strip labels, freeing room for tabs.
- Adjust the ChangesActionsBar CSS comments/scoping for the editor tabs
  title host.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 11:54
@sandy081 sandy081 self-assigned this Jul 9, 2026

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 relocates the Changes Create Pull Request button bar (ChangesActionsBar) from the sessions title bar (Menus.TitleBarSessionMenu, resolved via IActionViewItemService) to the single-pane editor tabs title (Menus.SessionsEditorTitle, resolved via the active editor pane's getActionViewItem). It also adds an icon-only collapse behavior driven by a ResizeObserver on the tab-bar ancestor so the bar yields horizontal space to the tabs when narrow. This fits into the vs/sessions Agents-window layout work where the single-pane Changes editor owns its header/actions.

Changes:

  • Re-anchor CHANGES_HEADER_ACTIONS_ID to Menus.SessionsEditorTitle gated on singlePaneChangesEditorTitle + SessionHasChangesContext, and provide the custom view item from SessionChangesEditor.getActionViewItem (removing the old IActionViewItemService registration on TitleBarSessionMenu).
  • Add a compactObs fed by _observeCompactWidth (ResizeObserver on the tab-bar ancestor) that both button-bar widgets read to strip labels below CHANGES_ACTIONS_BAR_COMPACT_WIDTH; the aux-bar view pane passes constObservable(false).
  • Update CSS/JSDoc comments to reflect the new editor-tabs-title host.
Show a summary per file
File Description
src/vs/sessions/contrib/changes/browser/changesViewActions.ts Moves the anchor action to Menus.SessionsEditorTitle with new gating; updates JSDoc.
src/vs/sessions/contrib/changes/browser/sessionChangesEditor.ts Adds getActionViewItem override to render ChangesActionsBarActionViewItem in single-pane.
src/vs/sessions/contrib/changes/browser/changesView.ts Adds compact-width observation, threshold const, compact-aware button configs, and removes the old title-bar view-item registration.
src/vs/sessions/contrib/changes/browser/media/sessionChangesEditor.css Comment-only updates describing the editor-tabs-title host.

Notes: an existing unit test (changesViewActions.test.ts, not part of this PR) still asserts the old menu location and will fail, and src/vs/sessions/LAYOUT.md still documents the title-bar hosting — both should be updated to match. See stored comments for details on the test breakage and the classic-header collapse discrepancy.

Review details

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

Comment on lines 160 to 168
menu: {
id: Menus.TitleBarSessionMenu,
id: Menus.SessionsEditorTitle,
group: 'navigation',
order: 5,
when: ContextKeyExpr.and(
IsSessionsWindowContext,
IsAuxiliaryWindowContext.toNegated(),
ContextKeyExpr.equals(`config.${DOCK_DETAIL_PANEL_SETTING}`, true),
singlePaneChangesEditorTitle,
SessionHasChangesContext
)
},
Comment on lines +483 to +488
// The editor-actions toolbar (which hosts this bar) may not be attached to
// the tab-bar DOM on the first animation frame, so retry finding the ancestor
// across a few frames before giving up. Fall back to the editor group container
// (the single-tab control has no `.tabs-and-actions-container`).
const trySetup = (attemptsLeft: number): void => {
const tabBar = (container.closest('.tabs-and-actions-container') ?? container.closest('.editor-group-container')) as HTMLElement | null;
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.

2 participants