From 860f38ba5312a3f7cbecc10e6de92f9b3ffa2de3 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 30 Jan 2024 09:24:06 +0100 Subject: [PATCH] aux window renames (#203775) --- .../browser/actions/layoutActions.ts | 6 ++--- src/vs/workbench/browser/contextkeys.ts | 10 ++++---- src/vs/workbench/browser/layout.ts | 24 +++++++++---------- src/vs/workbench/common/contextkeys.ts | 2 +- .../services/layout/browser/layoutService.ts | 4 ++-- .../test/browser/workbenchTestServices.ts | 2 +- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index 08e0fb7835796..3a741d1cdc7df 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -22,7 +22,7 @@ import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/b import { ToggleAuxiliaryBarAction } from 'vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions'; import { TogglePanelAction } from 'vs/workbench/browser/parts/panel/panelActions'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { AuxiliaryBarVisibleContext, PanelAlignmentContext, PanelVisibleContext, SideBarVisibleContext, FocusedViewContext, InEditorZenModeContext, IsCenteredLayoutContext, MainEditorAreaVisibleContext, IsMainWindowFullscreenContext, PanelPositionContext, IsAuxiliaryWindowFocusedContext, TitleBarStyleContext } from 'vs/workbench/common/contextkeys'; +import { AuxiliaryBarVisibleContext, PanelAlignmentContext, PanelVisibleContext, SideBarVisibleContext, FocusedViewContext, InEditorZenModeContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, IsMainWindowFullscreenContext, PanelPositionContext, IsAuxiliaryWindowFocusedContext, TitleBarStyleContext } from 'vs/workbench/common/contextkeys'; import { Codicon } from 'vs/base/common/codicons'; import { ThemeIcon } from 'vs/base/common/themables'; import { DisposableStore } from 'vs/base/common/lifecycle'; @@ -88,7 +88,7 @@ registerAction2(class extends Action2 { precondition: IsAuxiliaryWindowFocusedContext.toNegated(), category: Categories.View, f1: true, - toggled: IsCenteredLayoutContext, + toggled: IsMainEditorCenteredLayoutContext, menu: [{ id: MenuId.MenubarAppearanceMenu, group: '1_toggle_view', @@ -1388,7 +1388,7 @@ const AlignPanelActions: CustomizeLayoutItem[] = [ const MiscLayoutOptions: CustomizeLayoutItem[] = [ CreateOptionLayoutItem('workbench.action.toggleFullScreen', IsMainWindowFullscreenContext, localize('fullscreen', "Full Screen"), fullscreenIcon), CreateOptionLayoutItem('workbench.action.toggleZenMode', InEditorZenModeContext, localize('zenMode', "Zen Mode"), zenModeIcon), - CreateOptionLayoutItem('workbench.action.toggleCenteredLayout', IsCenteredLayoutContext, localize('centeredLayout', "Centered Layout"), centerLayoutIcon), + CreateOptionLayoutItem('workbench.action.toggleCenteredLayout', IsMainEditorCenteredLayoutContext, localize('centeredLayout', "Centered Layout"), centerLayoutIcon), ]; const LayoutContextKeySet = new Set(); diff --git a/src/vs/workbench/browser/contextkeys.ts b/src/vs/workbench/browser/contextkeys.ts index c10da3b722c13..a1663743d762b 100644 --- a/src/vs/workbench/browser/contextkeys.ts +++ b/src/vs/workbench/browser/contextkeys.ts @@ -7,7 +7,7 @@ import { Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from 'vs/platform/contextkey/common/contextkey'; import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from 'vs/platform/contextkey/common/contextkeys'; -import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, MainEditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, ActiveEditorCanToggleReadonlyContext, applyAvailableEditorIds, TitleBarVisibleContext, TitleBarStyleContext, MultipleEditorGroupsContext, IsAuxiliaryWindowFocusedContext, ActiveCompareEditorOriginalWriteableContext } from 'vs/workbench/common/contextkeys'; +import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, MainEditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, ActiveEditorCanToggleReadonlyContext, applyAvailableEditorIds, TitleBarVisibleContext, TitleBarStyleContext, MultipleEditorGroupsContext, IsAuxiliaryWindowFocusedContext, ActiveCompareEditorOriginalWriteableContext } from 'vs/workbench/common/contextkeys'; import { TEXT_DIFF_EDITOR_ID, EditorInputCapabilities, SIDE_BY_SIDE_EDITOR_ID, EditorResourceAccessor, SideBySideEditor } from 'vs/workbench/common/editor'; import { trackFocus, addDisposableListener, EventType, onDidRegisterWindow, getActiveWindow } from 'vs/base/browser/dom'; import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; @@ -71,7 +71,7 @@ export class WorkbenchContextKeysHandler extends Disposable { private inZenModeContext: IContextKey; private isMainWindowFullscreenContext: IContextKey; private isAuxiliaryWindowFocusedContext: IContextKey; - private isCenteredLayoutContext: IContextKey; + private isMainEditorCenteredLayoutContext: IContextKey; private sideBarVisibleContext: IContextKey; private mainEditorAreaVisibleContext: IContextKey; private panelPositionContext: IContextKey; @@ -195,8 +195,8 @@ export class WorkbenchContextKeysHandler extends Disposable { // Zen Mode this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService); - // Centered Layout - this.isCenteredLayoutContext = IsCenteredLayoutContext.bindTo(this.contextKeyService); + // Centered Layout (Main Editor) + this.isMainEditorCenteredLayoutContext = IsMainEditorCenteredLayoutContext.bindTo(this.contextKeyService); // Editor Area this.mainEditorAreaVisibleContext = MainEditorAreaVisibleContext.bindTo(this.contextKeyService); @@ -266,7 +266,7 @@ export class WorkbenchContextKeysHandler extends Disposable { this.isMainWindowFullscreenContext.set(isFullscreen(mainWindow)); } })); - this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered))); + this._register(this.layoutService.onDidChangeMainEditorCenteredLayout(centered => this.isMainEditorCenteredLayoutContext.set(centered))); this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position))); this._register(this.layoutService.onDidChangePanelAlignment(alignment => this.panelAlignmentContext.set(alignment))); diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index ccdbaf9d6bd95..11fe93c2cf69d 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -126,8 +126,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi private readonly _onDidChangeZenMode = this._register(new Emitter()); readonly onDidChangeZenMode = this._onDidChangeZenMode.event; - private readonly _onDidChangeCenteredLayout = this._register(new Emitter()); - readonly onDidChangeCenteredLayout = this._onDidChangeCenteredLayout.event; + private readonly _onDidChangeMainEditorCenteredLayout = this._register(new Emitter()); + readonly onDidChangeMainEditorCenteredLayout = this._onDidChangeMainEditorCenteredLayout.event; private readonly _onDidChangePanelAlignment = this._register(new Emitter()); readonly onDidChangePanelAlignment = this._onDidChangePanelAlignment.event; @@ -338,7 +338,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi this._register(this.editorGroupService.mainPart.onDidActivateGroup(showEditorIfHidden)); // Revalidate center layout when active editor changes: diff editor quits centered mode. - this._register(this.mainPartEditorService.onDidActiveEditorChange(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)))); + this._register(this.mainPartEditorService.onDidActiveEditorChange(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)))); }); // Configuration changes @@ -371,9 +371,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi this._register(onDidChangeFullscreen(windowId => this.onFullscreenChanged(windowId))); // Group changes - this._register(this.editorGroupService.mainPart.onDidAddGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)))); - this._register(this.editorGroupService.mainPart.onDidRemoveGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)))); - this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)))); + this._register(this.editorGroupService.mainPart.onDidAddGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)))); + this._register(this.editorGroupService.mainPart.onDidRemoveGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)))); + this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)))); // Prevent workbench from scrolling #55456 this._register(addDisposableListener(this.mainContainer, EventType.SCROLL, () => this.mainContainer.scrollTop = 0)); @@ -511,7 +511,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi // Centered Layout this.editorGroupService.whenRestored.then(() => { - this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED), skipLayout); + this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED), skipLayout); }); } @@ -1069,7 +1069,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi } // Restore Main Editor Center Mode - if (this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)) { + if (this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)) { this.centerMainEditorLayout(true, true); } @@ -1631,11 +1631,11 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi } isMainEditorLayoutCentered(): boolean { - return this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED); + return this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED); } centerMainEditorLayout(active: boolean, skipLayout?: boolean): void { - this.stateModel.setRuntimeValue(LayoutStateKeys.EDITOR_CENTERED, active); + this.stateModel.setRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED, active); const activeMainEditor = this.mainPartEditorService.activeEditor; @@ -1662,7 +1662,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi } } - this._onDidChangeCenteredLayout.fire(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)); + this._onDidChangeMainEditorCenteredLayout.fire(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)); } resizePart(part: Parts, sizeChangeWidth: number, sizeChangeHeight: number): void { @@ -2550,7 +2550,7 @@ class InitializationStateKey extends WorkbenchLayoutSt const LayoutStateKeys = { // Editor - EDITOR_CENTERED: new RuntimeStateKey('editor.centered', StorageScope.WORKSPACE, StorageTarget.MACHINE, false), + MAIN_EDITOR_CENTERED: new RuntimeStateKey('editor.centered', StorageScope.WORKSPACE, StorageTarget.MACHINE, false), // Zen Mode ZEN_MODE_ACTIVE: new RuntimeStateKey('zenMode.active', StorageScope.WORKSPACE, StorageTarget.MACHINE, false), diff --git a/src/vs/workbench/common/contextkeys.ts b/src/vs/workbench/common/contextkeys.ts index b778b1689df9c..a6464aeacd9ce 100644 --- a/src/vs/workbench/common/contextkeys.ts +++ b/src/vs/workbench/common/contextkeys.ts @@ -82,7 +82,7 @@ export const IsAuxiliaryEditorPartContext = new RawContextKey('isAuxili // Editor Layout Context Keys export const EditorsVisibleContext = new RawContextKey('editorIsOpen', false, localize('editorIsOpen', "Whether an editor is open")); export const InEditorZenModeContext = new RawContextKey('inZenMode', false, localize('inZenMode', "Whether Zen mode is enabled")); -export const IsCenteredLayoutContext = new RawContextKey('isCenteredLayout', false, localize('isCenteredLayout', "Whether centered layout is enabled")); +export const IsMainEditorCenteredLayoutContext = new RawContextKey('isCenteredLayout', false, localize('isMainEditorCenteredLayout', "Whether centered layout is enabled for the main editor")); export const SplitEditorsVertically = new RawContextKey('splitEditorsVertically', false, localize('splitEditorsVertically', "Whether editors split vertically")); export const MainEditorAreaVisibleContext = new RawContextKey('mainEditorAreaVisible', true, localize('mainEditorAreaVisible', "Whether the editor area in the main window is visible")); export const EditorTabsVisibleContext = new RawContextKey('editorTabsVisible', true, localize('editorTabsVisible', "Whether editor tabs are visible")); diff --git a/src/vs/workbench/services/layout/browser/layoutService.ts b/src/vs/workbench/services/layout/browser/layoutService.ts index c1091f8e7a618..fe70a7cf89a76 100644 --- a/src/vs/workbench/services/layout/browser/layoutService.ts +++ b/src/vs/workbench/services/layout/browser/layoutService.ts @@ -130,9 +130,9 @@ export interface IWorkbenchLayoutService extends ILayoutService { readonly onDidChangeWindowMaximized: Event<{ readonly windowId: number; readonly maximized: boolean }>; /** - * Emits when centered layout is enabled or disabled. + * Emits when main editor centered layout is enabled or disabled. */ - readonly onDidChangeCenteredLayout: Event; + readonly onDidChangeMainEditorCenteredLayout: Event; /* * Emit when panel position changes. diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index dac55f97d95c5..f006962a20945 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -605,7 +605,7 @@ export class TestLayoutService implements IWorkbenchLayoutService { activeContainer: HTMLElement = mainWindow.document.body; onDidChangeZenMode: Event = Event.None; - onDidChangeCenteredLayout: Event = Event.None; + onDidChangeMainEditorCenteredLayout: Event = Event.None; onDidChangeWindowMaximized: Event<{ windowId: number; maximized: boolean }> = Event.None; onDidChangePanelPosition: Event = Event.None; onDidChangePanelAlignment: Event = Event.None;