sessions: move Create Pull Request bar to the editor tabs title#325122
sessions: move Create Pull Request bar to the editor tabs title#325122sandy081 wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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_IDtoMenus.SessionsEditorTitlegated onsinglePaneChangesEditorTitle+SessionHasChangesContext, and provide the custom view item fromSessionChangesEditor.getActionViewItem(removing the oldIActionViewItemServiceregistration onTitleBarSessionMenu). - Add a
compactObsfed by_observeCompactWidth(ResizeObserver on the tab-bar ancestor) that both button-bar widgets read to strip labels belowCHANGES_ACTIONS_BAR_COMPACT_WIDTH; the aux-bar view pane passesconstObservable(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
| 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 | ||
| ) | ||
| }, |
| // 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; |
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
CHANGES_HEADER_ACTIONS_IDis now contributed toMenus.SessionsEditorTitle(navigation, order 5), gated on the Changes editor being active in single-pane (singlePaneChangesEditorTitle) +SessionHasChangesContext, replacing the previousMenus.TitleBarSessionMenuhosting.SessionChangesEditor.getActionViewItemreturnsChangesActionsBarActionViewItemforCHANGES_HEADER_ACTIONS_IDin single-pane, so the group's editor-actions toolbar renders the bar (that toolbar resolves custom items via the active editor pane, notIActionViewItemService).ResizeObserveron the tab-bar ancestor drives a compact observable that both button-bar widgets (ChangesMenuWorkbenchButtonBarWidgetfor git/Copilot CLI,ChangesWorkbenchButtonBarWidgetfor agent-host) read to strip button labels belowCHANGES_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-containerwhen there is no.tabs-and-actions-container.ChangesActionsBarcomments/scoping for the editor tabs title host; the classic internal changes-editor header path is unchanged (passesconstObservable(false)for compact).Notes for reviewers
ChangesActionsBarand does not collapse (no tab-bar ancestor to observe).CHANGES_ACTIONS_BAR_COMPACT_WIDTH = 500) may need calibration against real tab-bar widths.