remove toggle panel alignment setting

This commit is contained in:
SteVen Batten
2022-01-18 16:15:35 -08:00
parent dbe2b5c216
commit 60b5c439a4
8 changed files with 29 additions and 29 deletions
+6 -1
View File
@@ -17,7 +17,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { SideBarVisibleContext } from 'vs/workbench/common/viewlet';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { PanelMaximizedContext, PanelVisibleContext } from 'vs/workbench/common/panel';
import { PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext } from 'vs/workbench/common/panel';
import { getRemoteName, getVirtualWorkspaceScheme } from 'vs/platform/remote/common/remoteHosts';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { isNative } from 'vs/base/common/platform';
@@ -83,6 +83,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
private sideBarVisibleContext: IContextKey<boolean>;
private editorAreaVisibleContext: IContextKey<boolean>;
private panelVisibleContext: IContextKey<boolean>;
private panelAlignmentContext: IContextKey<string>;
private panelMaximizedContext: IContextKey<boolean>;
private auxiliaryBarVisibleContext: IContextKey<boolean>;
private editorTabsVisibleContext: IContextKey<boolean>;
@@ -201,6 +202,8 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.panelVisibleContext.set(this.layoutService.isVisible(Parts.PANEL_PART));
this.panelMaximizedContext = PanelMaximizedContext.bindTo(this.contextKeyService);
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());
this.panelAlignmentContext = PanelAlignmentContext.bindTo(this.contextKeyService);
this.panelAlignmentContext.set(this.layoutService.getPanelAlignment());
// Auxiliary Bar
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
@@ -245,6 +248,8 @@ export class WorkbenchContextKeysHandler extends Disposable {
this._register(this.layoutService.onDidChangeFullscreen(fullscreen => this.isFullscreenContext.set(fullscreen)));
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onDidChangePanelAlignment(alignment => this.panelAlignmentContext.set(alignment)));
this._register(this.paneCompositeService.onDidPaneCompositeClose(() => this.updateSideBarContextKeys()));
this._register(this.paneCompositeService.onDidPaneCompositeOpen(() => this.updateSideBarContextKeys()));
+6 -1
View File
@@ -114,6 +114,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private readonly _onDidChangeCenteredLayout = this._register(new Emitter<boolean>());
readonly onDidChangeCenteredLayout = this._onDidChangeCenteredLayout.event;
private readonly _onDidChangePanelAlignment = this._register(new Emitter<PanelAlignment>());
readonly onDidChangePanelAlignment = this._onDidChangePanelAlignment.event;
private readonly _onDidChangeWindowMaximized = this._register(new Emitter<boolean>());
readonly onDidChangeWindowMaximized = this._onDidChangeWindowMaximized.event;
@@ -1494,6 +1497,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT, alignment);
this.adjustPartPositions(this.getSideBarPosition(), alignment);
this._onDidChangePanelAlignment.fire(alignment);
}
private setPanelHidden(hidden: boolean, skipLayout?: boolean): void {
@@ -1681,7 +1686,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON);
}
private getPanelAlignment(): PanelAlignment {
getPanelAlignment(): PanelAlignment {
return this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT);
}
-8
View File
@@ -108,10 +108,6 @@ export class LayoutStateModel extends Disposable {
this.setRuntimeValueAndFire(LayoutStateKeys.STATUSBAR_HIDDEN, !this.configurationService.getValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE));
}
if (configurationChangeEvent.affectsConfiguration(LegacyWorkbenchLayoutSettings.PANEL_ALIGNMENT)) {
this.setRuntimeValueAndFire(LayoutStateKeys.PANEL_ALIGNMENT, this.configurationService.getValue(LegacyWorkbenchLayoutSettings.PANEL_ALIGNMENT));
}
if (configurationChangeEvent.affectsConfiguration(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION)) {
this.setRuntimeValueAndFire(LayoutStateKeys.SIDEBAR_POSITON, positionFromString(this.configurationService.getValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION) ?? 'left'));
}
@@ -127,8 +123,6 @@ export class LayoutStateModel extends Disposable {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.ACTIVITYBAR_VISIBLE, !value);
} else if (key === LayoutStateKeys.STATUSBAR_HIDDEN) {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE, !value);
} else if (key === LayoutStateKeys.PANEL_ALIGNMENT) {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.PANEL_ALIGNMENT, value);
} else if (key === LayoutStateKeys.SIDEBAR_POSITON) {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION, positionToString(value as Position));
}
@@ -150,7 +144,6 @@ export class LayoutStateModel extends Disposable {
// Apply legacy settings
this.stateCache.set(LayoutStateKeys.ACTIVITYBAR_HIDDEN.name, !this.configurationService.getValue(LegacyWorkbenchLayoutSettings.ACTIVITYBAR_VISIBLE));
this.stateCache.set(LayoutStateKeys.STATUSBAR_HIDDEN.name, !this.configurationService.getValue(LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE));
this.stateCache.set(LayoutStateKeys.PANEL_ALIGNMENT.name, this.configurationService.getValue(LegacyWorkbenchLayoutSettings.PANEL_ALIGNMENT));
this.stateCache.set(LayoutStateKeys.SIDEBAR_POSITON.name, positionFromString(this.configurationService.getValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION) ?? 'left'));
// Set dynamic defaults: part sizing and side bar visibility
@@ -260,5 +253,4 @@ enum LegacyWorkbenchLayoutSettings {
ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible', // Deprecated to UI State
STATUSBAR_VISIBLE = 'workbench.statusBar.visible', // Deprecated to UI State
SIDEBAR_POSITION = 'workbench.sideBar.location', // Deprecated to UI State
PANEL_ALIGNMENT = 'workbench.experimental.panel.alignment', // Deprecated to UI State
}
@@ -13,7 +13,7 @@ import { IWorkbenchActionRegistry, Extensions as WorkbenchExtensions, CATEGORIES
import { IWorkbenchLayoutService, PanelAlignment, Parts, Position, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
import { ActivityAction, ToggleCompositePinnedAction, ICompositeBar } from 'vs/workbench/browser/parts/compositeBarActions';
import { IActivity } from 'vs/workbench/common/activity';
import { ActivePanelContext, PanelMaximizedContext, PanelPositionContext, PanelVisibleContext } from 'vs/workbench/common/panel';
import { ActivePanelContext, PanelAlignmentContext, PanelMaximizedContext, PanelPositionContext, PanelVisibleContext } from 'vs/workbench/common/panel';
import { ContextKeyExpr, ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey';
import { Codicon } from 'vs/base/common/codicons';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
@@ -112,7 +112,7 @@ function createPositionPanelActionConfig(id: string, alias: string, label: strin
}
function createAlignmentPanelActionConfig(id: string, alias: string, label: string, shortLabel: string, alignment: PanelAlignment): PanelActionConfig<PanelAlignment> {
return createPanelActionConfig<PanelAlignment>(id, alias, label, shortLabel, alignment, ContextKeyExpr.notEquals('config.workbench.experimental.panel.alignment', alignment));
return createPanelActionConfig<PanelAlignment>(id, alias, label, shortLabel, alignment, PanelAlignmentContext.notEqualsTo(alignment));
}
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import product from 'vs/platform/product/common/product';
import { Registry } from 'vs/platform/registry/common/platform';
import { localize } from 'vs/nls';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
@@ -363,19 +362,6 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
'default': false,
'description': localize('layoutControlEnabled', "Controls whether the layout control button in the custom title bar is enabled."),
},
'workbench.experimental.panel.alignment': {
'type': 'string',
'enum': ['left', 'center', 'right', 'justify'],
'enumDescriptions': [
localize('panel.alignment.left', "The panel spans from the far left of the window to the right side of the editor area."),
localize('panel.alignment.center', "The panel spans beneath the editor area."),
localize('panel.alignment.right', "The panel spans from the left side of the editor area to the far right of the window."),
localize('panel.alignment.justify', "The panel spans the full width of the window."),
],
'default': 'center',
'description': localize('panelAlignment', "Controls the alignment of the panel (terminal, debug console, output, problems) and whether or not it spans beneath the side bar and side panel. Note that this setting only takes effect when the panel is positioned at the bottom of the screen."),
'included': product.quality !== 'stable'
},
}
});
+2 -1
View File
@@ -8,6 +8,7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export const ActivePanelContext = new RawContextKey<string>('activePanel', '', localize('activePanel', "The identifier of the active panel"));
export const PanelFocusContext = new RawContextKey<boolean>('panelFocus', false, localize('panelFocus', "Whether the panel has keyboard focus"));
export const PanelPositionContext = new RawContextKey<string>('panelPosition', 'bottom', localize('panelPosition', "The position of the panel, either 'left', 'right' or 'bottom'"));
export const PanelPositionContext = new RawContextKey<string>('panelPosition', 'bottom', localize('panelPosition', "The position of the panel, always 'bottom'"));
export const PanelAlignmentContext = new RawContextKey<string>('panelAlignment', 'center', localize('panelAlignment', "The alignment of the panel, either 'center', 'left', 'right' or 'justify'"));
export const PanelVisibleContext = new RawContextKey<boolean>('panelVisible', false, localize('panelVisible', "Whether the panel is visible"));
export const PanelMaximizedContext = new RawContextKey<boolean>('panelMaximized', false, localize('panelMaximized', "Whether the panel is maximized"));
@@ -99,6 +99,11 @@ export interface IWorkbenchLayoutService extends ILayoutService {
*/
readonly onDidChangeCenteredLayout: Event<boolean>;
/**
* Emit when panel alignment changes.
*/
readonly onDidChangePanelAlignment: Event<PanelAlignment>;
/**
* Emit when part visibility changes
*/
@@ -196,6 +201,12 @@ export interface IWorkbenchLayoutService extends ILayoutService {
*/
toggleMenuBar(): void;
/**
*
* Gets the panel alignement.
*/
getPanelAlignment(): PanelAlignment;
/**
* Sets the panel alignment.
*/
@@ -542,7 +542,7 @@ export class TestLayoutService implements IWorkbenchLayoutService {
onDidChangeCenteredLayout: Event<boolean> = Event.None;
onDidChangeFullscreen: Event<boolean> = Event.None;
onDidChangeWindowMaximized: Event<boolean> = Event.None;
onDidChangePanelPosition: Event<string> = Event.None;
onDidChangePanelAlignment: Event<PanelAlignment> = Event.None;
onDidChangePartVisibility: Event<void> = Event.None;
onDidLayout = Event.None;
onDidChangeNotificationsVisibility = Event.None;
@@ -576,7 +576,7 @@ export class TestLayoutService implements IWorkbenchLayoutService {
getMenubarVisibility(): MenuBarVisibility { throw new Error('not implemented'); }
toggleMenuBar(): void { }
getSideBarPosition() { return 0; }
getPanelPosition() { return 0; }
getPanelAlignment(): PanelAlignment { return 'center'; }
async setPanelPosition(_position: PartPosition): Promise<void> { }
async setPanelAlignment(_alignment: PanelAlignment): Promise<void> { }
addClass(_clazz: string): void { }