diff --git a/src/vs/sessions/LAYOUT.md b/src/vs/sessions/LAYOUT.md index dd62223853f..e47cacd00c7 100644 --- a/src/vs/sessions/LAYOUT.md +++ b/src/vs/sessions/LAYOUT.md @@ -199,7 +199,7 @@ Editors open as modal overlays rather than occupying grid space. The configurati | Editor opens (no explicit group) | Opens in modal overlay | | All editors closed / Escape / backdrop click | Modal closes and is disposed | -When the editor part is shown in the grid (not as a modal), its title toolbar (`MenuId.EditorTitleLayout`, right of the tabs) hosts layout actions registered in `contrib/editor/browser/editor.contribution.ts`, ordered left-to-right as: open in modal editor, **maximize / restore editor area**, a single **Toggle Details** action for the auxiliary bar (labelled "Toggle Secondary Side Bar" in the non-single-pane layout), and **close editor area**. The auxiliary-bar toggle sits to the right of maximize/restore because it changes the right-hand side of the layout. It reuses the core `workbench.action.toggleAuxiliaryBar` command (already registered in the agents window by the workbench auxiliary bar part, and available in the Command Palette under **View**) surfaced through two `when`-gated menu items in `browser/layoutActions.ts` so the icon flips without rendering a checked/highlighted state: the `right-panel-show` codicon shows when the auxiliary bar is hidden (`AuxiliaryBarVisibleContext` negated, click to show) and the `right-panel-hide` codicon shows when it is visible (click to hide). +When the editor part is shown in the grid (not as a modal), its title toolbar (`MenuId.EditorTitleLayout`, right of the tabs) hosts layout actions registered in `contrib/editor/browser/editor.contribution.ts`, ordered left-to-right as: open in modal editor, **maximize / restore editor area**, a single **Toggle Details** action for the auxiliary bar (labelled "Toggle Secondary Side Bar" in the non-single-pane layout), and **close editor area**. The auxiliary-bar toggle sits to the right of maximize/restore because it changes the right-hand side of the layout. It reuses the core `workbench.action.toggleAuxiliaryBar` command (already registered in the agents window by the workbench auxiliary bar part, and available in the Command Palette under **View**) surfaced through two `when`-gated menu items in `browser/layoutActions.ts` so the icon flips without rendering a checked/highlighted state: the `right-panel-show` codicon shows when the auxiliary bar is hidden (`AuxiliaryBarVisibleContext` negated, click to show) and the `right-panel-hide` codicon shows when it is visible (click to hide). In the Agents-window tab strip, the editor-actions side first shrinks down to 50px before the tab scroller starts shrinking. When the auxiliary bar is hidden the editor becomes the rightmost card and expands into the freed space; the workbench's 10px right gutter still applies, and a `.noauxiliarybar` rule in `browser/media/style.css` restores the editor's right border and right corner radii so it keeps its card appearance. @@ -218,7 +218,7 @@ The entire third-pane redesign is gated behind the experimental setting `session - The auxiliary bar is removed from the workbench grid and **docked inside the editor part** (absolutely positioned on the right, below the editor tab strip); the grid's top-right row becomes `Sessions | Editor`, and the editor part spans the editor + detail-panel width. - The editor group's **title/tab strip spans the full width** while its content is inset on the right by the detail-panel width, via the concrete `EditorPart.setContentRightInset(px)` method (`EditorPart`/`EditorGroupView`; not on the `IEditorPart` interface; `0` = no-op for all other layouts). -- A **full-width header** sits below the tab bar, spanning the editor content and the docked detail panel, and hosts contributed actions. **The header menus are a group-level configuration; opting in is per-editor.** An editor part configures its groups with optional menu ids via `IEditorGroupViewOptions.menuIds` (`{ headerPrimary, headerSecondary, editorActions, tabsBarContext }`) — the core `EditorGroupView` never references any concrete menu point, it just renders whatever menu ids it was constructed with. `EditorPart.getGroupViewOptions()` is a protected hook (default `undefined`) that supplies these options to every group the part creates; `SinglePaneMainEditorPart` overrides it to return `Menus.SessionsEditorHeaderPrimary` / `Menus.SessionsEditorHeaderSecondary` / `Menus.SessionsEditorTitle` / `Menus.SessionsEditorTabsBarContext` (all defined in the sessions layer's shared menu registry, `browser/menus.ts`, not in core `platform/actions`). A header only renders while the **active editor opts in** via `IEditorPane.getHeaderActions()`, which returns just `{ instantiationService }` (the editor-scoped instantiation service so the header actions' `when` clauses evaluate in the editor's context) or `undefined` for no header; `EditorGroupView._renderEditorHeader` (run on every active-editor change) renders the group's configured menus as leading/trailing `MenuWorkbenchToolBar`s (`.editor-group-header-primary` / `.editor-group-header-secondary`, wrap-reversed so trailing actions float up) using that scoped service, hiding the whole header while both menus are empty. The header is a **real flow row inside the editor group** — `EditorGroupView` renders an optional `.editor-group-header` between its `.title` (tabs) and `.editor-container`, and **owns the header rendering and sizing**: the internal `setHeaderContent(render)` creates the inner content element, runs the render callback, and keeps the row **auto-sized to the content** via a `ResizeObserver` (wrapping and growing as needed, firing `onDidChangeHeaderHeight`); `headerHeight` exposes the reserved height. The group lays it out in flow (no absolute positioning) and shifts the editor pane down by its height. `SinglePaneMainEditorPart` renders no header DOM; it only offsets the docked auxiliary bar + sash down by `group.headerHeight` (`IDockedAuxiliaryBarHost.getHeaderHeight()`, re-applied on `onDidChangeHeaderHeight` via `_registerGroupHeader()`). The **Changes editor** (`SessionChangesEditor`) implements `getHeaderActions()` in single-pane (returning its scoped instantiation service), so the group renders `Menus.SessionsEditorHeaderPrimary` (to the left: the *Branch Changes* dropdown + diff-stats `navigation` — the diff-stats is an icon-less "N files +X -Y" label with the *files* count in `descriptionForeground`) and `Menus.SessionsEditorHeaderSecondary` (to the right, all inline unless overflowed: *Run Code Review* first in the `navigation` group, then a separated `1_diff` group with collapse/expand + *Show Side by Side Diff* / *Show Inline Diff* (mutually exclusive by render mode); the sentinel `secondary` group — *View as List/Tree* — falls into the toolbar's overflow "…" menu) for the Changes tab only. When the editor area is **collapsed**, the left header's non-interactive diff-stats label is replaced by a compact clickable "+X -Y" reveal (`VIEW_SESSION_CHANGES_COMMAND_ID`, rendered by the base `ChangesDiffStatsActionItem`, gated `MainEditorAreaVisibleContext.negate()`) that opens the Changes editor on click. The **Create Pull Request** button bar (`ChangesActionsBar`) is hosted in the **title bar right** (the session actions area of the sessions titlebar), not the editor: a header anchor action (`CHANGES_HEADER_ACTIONS_ID`, registered in `changesViewActions.ts`, contributed to `Menus.TitleBarSessionMenu` group `navigation` order 5 and gated on `IsSessionsWindowContext` + `IsAuxiliaryWindowContext.toNegated()` + the dock-detail-panel setting + `SessionHasChangesContext`) is rendered by the titlebar's session-actions toolbar (a `MenuWorkbenchToolBar` that consults `IActionViewItemService`). `SessionHasChangesContext` resolves here because `sessionsService` binds the active session's context keys on the window's root context. The bar's view item (`ChangesActionsBarActionViewItem`) is registered for `(Menus.TitleBarSessionMenu, CHANGES_HEADER_ACTIONS_ID)` in `ChangesEditorHeaderContribution` (`contrib/changes/browser/changesView.ts`), and its buttons are shrunk to 20px in the toolbar context via CSS. It hides entirely when its `AgentsChangesToolbar` menu has no actions. (In the classic non-single-pane layout the same `ChangesActionsBar` is still rendered inside `SessionChangesEditor`'s internal header.) The header-primary custom action view items (picker, single-pane diff-stats pill) are registered globally by `(menuId, actionId)` via `IActionViewItemService` in `ChangesEditorHeaderContribution` (`contrib/changes/browser/changesView.ts`), so the group's generic menu toolbars resolve them. The same *Branch Changes* picker and diff-stats actions are also contributed to the classic aux-bar Changes view menus (`ChatEditingSessionChangesFileHeaderToolbar` / `…RightToolbar`), which that view renders with its own action view items — so the two surfaces stay independent. +- A **full-width header** sits below the tab bar, spanning the editor content and the docked detail panel, and hosts contributed actions. **The header menus are a group-level configuration; opting in is per-editor.** An editor part configures its groups with optional menu ids via `IEditorGroupViewOptions.menuIds` (`{ headerPrimary, headerSecondary, editorActions, tabsBarContext }`) — the core `EditorGroupView` never references any concrete menu point, it just renders whatever menu ids it was constructed with. `EditorPart.getGroupViewOptions()` is a protected hook (default `undefined`) that supplies these options to every group the part creates; `SinglePaneMainEditorPart` overrides it to return `Menus.SessionsEditorHeaderPrimary` / `Menus.SessionsEditorHeaderSecondary` / `Menus.SessionsEditorTitle` / `Menus.SessionsEditorTabsBarContext` (all defined in the sessions layer's shared menu registry, `browser/menus.ts`, not in core `platform/actions`). A header only renders while the **active editor opts in** via `IEditorPane.getHeaderActions()`, which returns just `{ instantiationService }` (the editor-scoped instantiation service so the header actions' `when` clauses evaluate in the editor's context) or `undefined` for no header; `EditorGroupView._renderEditorHeader` (run on every active-editor change) renders the group's configured menus as leading/trailing `MenuWorkbenchToolBar`s (`.editor-group-header-primary` / `.editor-group-header-secondary`, wrap-reversed so trailing actions float up) using that scoped service, hiding the whole header while both menus are empty. The header is a **real flow row inside the editor group** — `EditorGroupView` renders an optional `.editor-group-header` between its `.title` (tabs) and `.editor-container`, and **owns the header rendering and sizing**: the internal `setHeaderContent(render)` creates the inner content element, runs the render callback, and keeps the row **auto-sized to the content** via a `ResizeObserver` (wrapping and growing as needed, firing `onDidChangeHeaderHeight`); `headerHeight` exposes the reserved height. The group lays it out in flow (no absolute positioning) and shifts the editor pane down by its height. `SinglePaneMainEditorPart` renders no header DOM; it only offsets the docked auxiliary bar + sash down by `group.headerHeight` (`IDockedAuxiliaryBarHost.getHeaderHeight()`, re-applied on `onDidChangeHeaderHeight` via `_registerGroupHeader()`). The **Changes editor** (`SessionChangesEditor`) implements `getHeaderActions()` in single-pane (returning its scoped instantiation service), so the group renders `Menus.SessionsEditorHeaderPrimary` (to the left: the *Branch Changes* dropdown + diff-stats `navigation` — the diff-stats is an icon-less "N files +X -Y" label with the *files* count in `descriptionForeground`) and `Menus.SessionsEditorHeaderSecondary` (to the right, all inline unless overflowed: *Run Code Review* first in the `navigation` group, then a separated `1_diff` group with collapse/expand + *Show Side by Side Diff* / *Show Inline Diff* (mutually exclusive by render mode); the sentinel `secondary` group — *View as List/Tree* — falls into the toolbar's overflow "…" menu) for the Changes tab only. When the editor area is **collapsed**, the left header's non-interactive diff-stats label is replaced by a compact clickable "+X -Y" reveal (`VIEW_SESSION_CHANGES_COMMAND_ID`, rendered by the base `ChangesDiffStatsActionItem`, gated `MainEditorAreaVisibleContext.negate()`) that opens the Changes editor on click. The **Create Pull Request** button bar (`ChangesActionsBar`) is hosted in the editor tabs title: a header anchor action (`CHANGES_HEADER_ACTIONS_ID`, registered in `changesViewActions.ts`, contributed to `Menus.SessionsEditorTitle` group `navigation` order 5 and gated on the active Changes editor, top-right editor group, main window, dock-detail-panel setting, and `SessionHasChangesContext`) is rendered by the editor group's title actions. Its custom view item is supplied by `SessionChangesEditor.getActionViewItem()` as `ChangesActionsBarActionViewItem`, and the CSS makes the editor-actions side shrink to 50px before the tab scroller shrinks; split-button labels ellipsize while the dropdown segment stays visible. It hides entirely when its `AgentsChangesToolbar` menu has no actions. (In the classic non-single-pane layout the same `ChangesActionsBar` is still rendered inside `SessionChangesEditor`'s internal header.) The header-primary custom action view items (picker, single-pane diff-stats pill) are registered globally by `(menuId, actionId)` via `IActionViewItemService` in `ChangesEditorHeaderContribution` (`contrib/changes/browser/changesView.ts`), so the group's generic menu toolbars resolve them. The same *Branch Changes* picker and diff-stats actions are also contributed to the classic aux-bar Changes view menus (`ChatEditingSessionChangesFileHeaderToolbar` / `…RightToolbar`), which that view renders with its own action view items — so the two surfaces stay independent. - A vertical **sash** on the left edge of the docked panel resizes it (`DockedAuxiliaryBarController` in `browser/dockedAuxiliaryBarController.ts` owns `layout()` / `_ensureSash()`, created/driven by `SinglePaneMainEditorPart`). The preferred first-open width is 300px; explicit user resizes persist via the part-sizes snapshot. While the panel is visible it clamps to `[220px, editorWidth - 300px]`; dragging the raw sash width down to ~0 hides the docked detail panel, leaving the editor content visible. Temporary width growth from collapsing the sessions list is restored before persistence and must not become the user's detail width. - Collapsing the sessions list transfers the freed sidebar width to the editor grid node when the editor content is **visible**, and to the **detail panel** (`_dockedAuxiliaryBarWidth`, with the editor node kept equal to it) when the editor content is **hidden** (detail-only). Reopening the sessions list restores the pre-collapse editor-node width / detail width. Keeping the hidden-editor node equal to the detail width ensures the width-based reveal-sync never mistakes a wide detail-only node for a revealed editor. - When the editor part is hidden while the docked detail panel remains visible, the editor grid node stays visible for the shared tab strip but shrinks to the persisted detail-panel width, letting the Sessions part absorb the freed editor-content space. The detail panel fills that narrowed node below the tab strip, the editor content area collapses to zero, and the sash is disabled without overwriting the persisted detail-panel width. If the user drags the left workbench grid sash until a visible editor node is squeezed back to the detail width, the editor content is hidden the same way, leaving detail-only. diff --git a/src/vs/sessions/browser/parts/media/editorPart.css b/src/vs/sessions/browser/parts/media/editorPart.css index c879b2fca36..549077b5954 100644 --- a/src/vs/sessions/browser/parts/media/editorPart.css +++ b/src/vs/sessions/browser/parts/media/editorPart.css @@ -31,6 +31,17 @@ padding-right: 0; } +.agent-sessions-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.tabs-border-bottom > .editor-actions { + flex: 0 999 auto; + min-width: 70px; + overflow: hidden; +} + +.agent-sessions-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.tabs-border-bottom > .monaco-scrollable-element { + flex: 1 1 auto; + min-width: 0; +} + .agent-sessions-workbench .part.editor > .content .editor-group-container > .title .editor-actions-separator { display: block; align-self: center; diff --git a/src/vs/sessions/contrib/changes/browser/changesView.ts b/src/vs/sessions/contrib/changes/browser/changesView.ts index 17836a779f3..953a3294ef9 100644 --- a/src/vs/sessions/contrib/changes/browser/changesView.ts +++ b/src/vs/sessions/contrib/changes/browser/changesView.ts @@ -446,18 +446,21 @@ export class ChangesActionsBar extends Disposable { updateVisibility(); })); } + } // --- Editor header menus (single-pane): the Changes editor declares // Menus.SessionsEditorHeaderPrimary (Branch Changes picker + diff stats, left) and // Menus.SessionsEditorHeaderSecondary (diff/code-review/view-mode actions, right), and // the editor group renders them. The Create Pull Request bar (ChangesActionsBar) is -// hosted in the sessions title bar (Menus.TitleBarSessionMenu). The custom action view -// items below are registered globally by menu id so the toolbars render them. +// hosted in the editor tabs title (Menus.SessionsEditorTitle); its custom action view +// item is provided by the Changes editor pane (SessionChangesEditor.getActionViewItem). +// The custom action view items below are registered globally by menu id so the +// header toolbars render them. export const CHANGES_HEADER_ACTIONS_ID = 'workbench.changesView.headerActions'; -/** Renders the {@link ChangesActionsBar} widget as the Create Pull Request title-bar action item. */ +/** Renders the {@link ChangesActionsBar} widget as the Create Pull Request editor tabs title action item. */ export class ChangesActionsBarActionViewItem extends BaseActionViewItem { constructor( action: IAction, @@ -509,11 +512,6 @@ class ChangesEditorHeaderContribution extends Disposable implements IWorkbenchCo return instantiationService.createInstance(ChangesDiffStatsActionItem, action, options); }, onDidRegister.event)); - // Create Pull Request button bar, hosted in the title bar (right, session actions area). - this._register(actionViewItemService.register(Menus.TitleBarSessionMenu, CHANGES_HEADER_ACTIONS_ID, (action, options, instantiationService) => { - return instantiationService.createInstance(ChangesActionsBarActionViewItem, action, options); - }, onDidRegister.event)); - onDidRegister.fire(); } } diff --git a/src/vs/sessions/contrib/changes/browser/changesViewActions.ts b/src/vs/sessions/contrib/changes/browser/changesViewActions.ts index 30e8caac8d0..b7996efd646 100644 --- a/src/vs/sessions/contrib/changes/browser/changesViewActions.ts +++ b/src/vs/sessions/contrib/changes/browser/changesViewActions.ts @@ -142,9 +142,11 @@ const singlePaneChangesEditorTitleVisible = ContextKeyExpr.and( /** * Anchor action hosting the Create Pull Request button bar ({@link ChangesActionsBar}) - * in the single-pane title bar (right side — the session actions area). The custom action - * view item is registered for {@link Menus.TitleBarSessionMenu} via IActionViewItemService - * in changesView.ts. The bar hides itself when its underlying menu has no actions. + * in the single-pane editor tabs title (the editor-actions area of the docked tab bar). + * The custom action view item is provided by the Changes editor pane + * ({@link SessionChangesEditor.getActionViewItem}) when the Changes editor is active, + * so the anchor is gated on the same. The bar hides itself when its underlying menu has + * no actions. */ class ChangesHeaderActionsAction extends Action2 { constructor() { @@ -153,13 +155,11 @@ class ChangesHeaderActionsAction extends Action2 { title: localize2('changesView.headerActions', "Changes Actions"), f1: false, menu: { - id: Menus.TitleBarSessionMenu, + id: Menus.SessionsEditorTitle, group: 'navigation', order: 5, when: ContextKeyExpr.and( - IsSessionsWindowContext, - IsAuxiliaryWindowContext.toNegated(), - SinglePaneLayoutEnabledContext, + singlePaneChangesEditorTitle, SessionHasChangesContext ) }, diff --git a/src/vs/sessions/contrib/changes/browser/media/sessionChangesEditor.css b/src/vs/sessions/contrib/changes/browser/media/sessionChangesEditor.css index eca4b82303c..2af34adae5f 100644 --- a/src/vs/sessions/contrib/changes/browser/media/sessionChangesEditor.css +++ b/src/vs/sessions/contrib/changes/browser/media/sessionChangesEditor.css @@ -250,7 +250,7 @@ /* Compact the ChangesActionsBar buttons to 24px (2px shorter than the classic * 26px header buttons) so the changes-editor header stays compact without extra - * header padding. Keyed off the bar's marker class. In the sessions title bar the + * header padding. Keyed off the bar's marker class. In the editor tabs title the * 20px override below (scoped to the toolbar action-item context) wins on * specificity, so this 24px baseline effectively applies to the classic internal * changes-editor header. */ @@ -261,8 +261,8 @@ } /* The Create Pull Request bar is rendered as a toolbar action item - * (`.action-item.changes-actions-bar` inside a `.monaco-action-bar`) in the sessions - * title bar (session actions area), where the classic + * (`.action-item.changes-actions-bar` inside a `.monaco-action-bar`) in the editor + * tabs title (the editor-actions area of the docked tab bar), where the classic * `.session-changes-editor-header-right` normalization does not reach. Scope these to * the action-item context so the classic internal changes-editor header and the aux-bar * Changes view are left untouched. */ @@ -270,23 +270,49 @@ display: flex; align-items: center; gap: var(--vscode-spacing-size40); + min-width: 0; /* Small breathing room so the button isn't flush against neighbouring toolbar icons. */ margin-left: var(--vscode-spacing-size20); margin-right: var(--vscode-spacing-size20); } -/* Render the button bar thinner so it sits comfortably in the title bar. Overrides the - * default 24px ChangesActionsBar button height without affecting the classic internal +/* Normalize the button bar height so it sits comfortably in the editor tabs title. Overrides the + * default ChangesActionsBar button height without affecting the classic internal * changes-editor header (which renders the bar on a plain div, not inside a * `.monaco-action-bar .action-item`). */ .monaco-action-bar .action-item.changes-actions-bar .monaco-button, .monaco-action-bar .action-item.changes-actions-bar .monaco-button-dropdown { - height: 20px; - min-height: 20px; + height: 26px; + min-height: 26px; padding-top: 0; padding-bottom: 0; } +.monaco-action-bar .action-item.changes-actions-bar .monaco-button-dropdown { + display: flex; + min-width: 0; + max-width: 100%; +} + +.monaco-action-bar .action-item.changes-actions-bar .monaco-button-dropdown > .monaco-button:not(.monaco-dropdown-button) { + flex: 1 1 auto; + flex-wrap: wrap; + min-width: 0; + overflow: hidden; +} + +.monaco-action-bar .action-item.changes-actions-bar .monaco-button-dropdown > .monaco-button-dropdown-separator, +.monaco-action-bar .action-item.changes-actions-bar .monaco-button-dropdown > .monaco-button.monaco-dropdown-button { + flex: 0 0 auto; +} + +.monaco-action-bar .action-item.changes-actions-bar .monaco-button > span:not(.codicon) { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + /* The generic actionbar rule `.monaco-action-bar .action-item .codicon { width: * 16px; height: 16px }` clamps every codicon — including the button elements * themselves (which carry the `codicon` class), squashing the secondary icon @@ -294,7 +320,8 @@ * specificity than the base rule) so the buttons size to their own content. */ .monaco-action-bar .action-item.changes-actions-bar .codicon { width: auto; - height: auto; + height: 24px; + flex-shrink: 0; color: var(--vscode-button-foreground) !important; } diff --git a/src/vs/sessions/contrib/changes/browser/sessionChangesEditor.ts b/src/vs/sessions/contrib/changes/browser/sessionChangesEditor.ts index 96a59906a0e..24a071ea38e 100644 --- a/src/vs/sessions/contrib/changes/browser/sessionChangesEditor.ts +++ b/src/vs/sessions/contrib/changes/browser/sessionChangesEditor.ts @@ -37,8 +37,11 @@ import { Menus } from '../../../browser/menus.js'; import { IAgentWorkbenchLayoutService } from '../../../browser/workbench.js'; import { ActiveSessionContextKeys } from '../common/changes.js'; import { IChangesViewService } from '../common/changesViewService.js'; -import { ChangesActionsBar } from './changesView.js'; +import { ChangesActionsBar, ChangesActionsBarActionViewItem, CHANGES_HEADER_ACTIONS_ID } from './changesView.js'; import { SessionChangesEditorInput } from './sessionChangesEditorInput.js'; +import { IAction } from '../../../../base/common/actions.js'; +import { IBaseActionViewItemOptions } from '../../../../base/browser/ui/actionbar/actionViewItems.js'; +import { IActionViewItem } from '../../../../base/browser/ui/actionbar/actionbar.js'; const HEADER_HEIGHT = 35; @@ -210,6 +213,17 @@ export class SessionChangesEditor extends AbstractEditorWithViewState { await super.setInput(input, options, context, token); const viewModel = await input.getViewModel(); diff --git a/src/vs/sessions/contrib/changes/test/browser/changesViewActions.test.ts b/src/vs/sessions/contrib/changes/test/browser/changesViewActions.test.ts index 2b7fe5df9a9..428b5326721 100644 --- a/src/vs/sessions/contrib/changes/test/browser/changesViewActions.test.ts +++ b/src/vs/sessions/contrib/changes/test/browser/changesViewActions.test.ts @@ -10,7 +10,7 @@ import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/tes import { isIMenuItem, MenuId, MenuRegistry } from '../../../../../platform/actions/common/actions.js'; import { isICommandActionToggleInfo } from '../../../../../platform/action/common/action.js'; import { EditorContextKeys } from '../../../../../editor/common/editorContextKeys.js'; -import { ActiveEditorContext, AuxiliaryBarVisibleContext, IsSessionsWindowContext, MainEditorAreaVisibleContext } from '../../../../../workbench/common/contextkeys.js'; +import { ActiveEditorContext, AuxiliaryBarVisibleContext, IsAuxiliaryWindowContext, IsSessionsWindowContext, IsTopRightEditorGroupContext, MainEditorAreaVisibleContext } from '../../../../../workbench/common/contextkeys.js'; import { Menus } from '../../../../browser/menus.js'; import { ChangesContextKeys } from '../../common/changes.js'; import { SessionHasChangesContext, SinglePaneLayoutEnabledContext } from '../../../../common/contextkeys.js'; @@ -184,24 +184,30 @@ suite('Changes View Actions', () => { }]); }); - test('Create Pull Request anchor is contributed to the title bar session menu', () => { - const item = MenuRegistry.getMenuItems(Menus.TitleBarSessionMenu) + test('Create Pull Request anchor is contributed to the editor tabs title menu', () => { + const item = MenuRegistry.getMenuItems(Menus.SessionsEditorTitle) .filter(isIMenuItem) .find(item => item.command.id === CHANGES_HEADER_ACTIONS_ID); - assert.ok(item, 'expected the changes header actions anchor on the title bar session menu'); + assert.ok(item, 'expected the changes header actions anchor on the editor tabs title menu'); const when = item.when?.serialize() ?? ''; assert.deepStrictEqual({ group: item.group, order: item.order, hasSessionsWindowGate: when.includes(IsSessionsWindowContext.key), + hasActiveEditorGate: when.includes(ActiveEditorContext.key) && when.includes(SessionChangesEditor.ID), hasSinglePaneConfigGate: when.includes(SinglePaneLayoutEnabledContext.key), + hasAuxiliaryWindowGate: when.includes(IsAuxiliaryWindowContext.key), + hasTopRightEditorGroupGate: when.includes(IsTopRightEditorGroupContext.key), hasChangesGate: when.includes(SessionHasChangesContext.key), }, { group: 'navigation', order: 5, hasSessionsWindowGate: true, + hasActiveEditorGate: true, hasSinglePaneConfigGate: true, + hasAuxiliaryWindowGate: true, + hasTopRightEditorGroupGate: true, hasChangesGate: true, }); });