remove panel location options in favor of new side panel behavior (#140742)

* remove panel location

* better command names

* smaller alignment window
This commit is contained in:
SteVen Batten
2022-01-14 13:53:11 -08:00
committed by GitHub
parent 17997da4ab
commit ea6f9fb6f4
16 changed files with 191 additions and 319 deletions
+1 -2
View File
@@ -102,8 +102,6 @@ export class MenuId {
static readonly ExtensionContext = new MenuId('ExtensionContext');
static readonly GlobalActivity = new MenuId('GlobalActivity');
static readonly LayoutControlMenu = new MenuId('LayoutControlMenu');
static readonly LayoutControlPanelPositionMenu = new MenuId('LayoutControlPanelPositionMenu');
static readonly LayoutControlPanelAlignmentMenu = new MenuId('LayoutControlPanelAlignmentMenu');
static readonly MenubarMainMenu = new MenuId('MenubarMainMenu');
static readonly MenubarAppearanceMenu = new MenuId('MenubarAppearanceMenu');
static readonly MenubarDebugMenu = new MenuId('MenubarDebugMenu');
@@ -114,6 +112,7 @@ export class MenuId {
static readonly MenubarHelpMenu = new MenuId('MenubarHelpMenu');
static readonly MenubarLayoutMenu = new MenuId('MenubarLayoutMenu');
static readonly MenubarNewBreakpointMenu = new MenuId('MenubarNewBreakpointMenu');
static readonly MenubarPanelAlignmentMenu = new MenuId('MenubarPanelAlignmentMenu');
static readonly MenubarPreferencesMenu = new MenuId('MenubarPreferencesMenu');
static readonly MenubarRecentMenu = new MenuId('MenubarRecentMenu');
static readonly MenubarSelectionMenu = new MenuId('MenubarSelectionMenu');
@@ -781,43 +781,6 @@ registerAction2(class extends Action2 {
}
});
// --- Swap Panel View Locations
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.movePanelToSidePanel',
title: {
value: localize('movePanelToSidePanel', "Move Panel To Side Panel"),
original: 'Move Panel To Side Panel'
},
category: CATEGORIES.View,
f1: true,
precondition: ContextKeyExpr.equals('config.workbench.experimental.sidePanel.enabled', true)
});
}
run(accessor: ServicesAccessor, ...args: any[]): void {
const viewDescriptorService = accessor.get(IViewDescriptorService);
const layoutService = accessor.get(IWorkbenchLayoutService);
const panelContainers = viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.Panel);
const auxiliaryBarContainers = viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.AuxiliaryBar);
panelContainers.forEach(viewContainer => viewDescriptorService.moveViewContainerToLocation(viewContainer, ViewContainerLocation.AuxiliaryBar));
auxiliaryBarContainers.forEach(viewContainer => viewDescriptorService.moveViewContainerToLocation(viewContainer, ViewContainerLocation.Panel));
if (panelContainers.length) {
layoutService.setPartHidden(false, Parts.AUXILIARYBAR_PART);
}
if (auxiliaryBarContainers.length) {
layoutService.setPartHidden(false, Parts.PANEL_PART);
}
}
});
// --- Resize View
abstract class BaseResizeViewAction extends Action2 {
+2 -6
View File
@@ -16,8 +16,8 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { SideBarVisibleContext } from 'vs/workbench/common/viewlet';
import { IWorkbenchLayoutService, Parts, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
import { PanelMaximizedContext, PanelPositionContext, PanelVisibleContext } from 'vs/workbench/common/panel';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { 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';
@@ -82,7 +82,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
private isCenteredLayoutContext: IContextKey<boolean>;
private sideBarVisibleContext: IContextKey<boolean>;
private editorAreaVisibleContext: IContextKey<boolean>;
private panelPositionContext: IContextKey<string>;
private panelVisibleContext: IContextKey<boolean>;
private panelMaximizedContext: IContextKey<boolean>;
private auxiliaryBarVisibleContext: IContextKey<boolean>;
@@ -198,8 +197,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.sideBarVisibleContext = SideBarVisibleContext.bindTo(this.contextKeyService);
// Panel
this.panelPositionContext = PanelPositionContext.bindTo(this.contextKeyService);
this.panelPositionContext.set(positionToString(this.layoutService.getPanelPosition()));
this.panelVisibleContext = PanelVisibleContext.bindTo(this.contextKeyService);
this.panelVisibleContext.set(this.layoutService.isVisible(Parts.PANEL_PART));
this.panelMaximizedContext = PanelMaximizedContext.bindTo(this.contextKeyService);
@@ -247,7 +244,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
this._register(this.layoutService.onDidChangeZenMode(enabled => this.inZenModeContext.set(enabled)));
this._register(this.layoutService.onDidChangeFullscreen(fullscreen => this.isFullscreenContext.set(fullscreen)));
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));
this._register(this.paneCompositeService.onDidPaneCompositeClose(() => this.updateSideBarContextKeys()));
this._register(this.paneCompositeService.onDidPaneCompositeOpen(() => this.updateSideBarContextKeys()));
+39 -138
View File
@@ -13,7 +13,7 @@ import { IUntypedEditorInput, pathsToEditors } from 'vs/workbench/common/editor'
import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput';
import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart';
import { Position, Parts, PanelOpensMaximizedOptions, IWorkbenchLayoutService, positionFromString, positionToString, panelOpensMaximizedFromString, PanelAlignment } from 'vs/workbench/services/layout/browser/layoutService';
import { Position, Parts, PanelOpensMaximizedOptions, IWorkbenchLayoutService, positionToString, panelOpensMaximizedFromString, PanelAlignment } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IStorageService, StorageScope, WillSaveStateReason } from 'vs/platform/storage/common/storage';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -116,9 +116,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private readonly _onDidChangeWindowMaximized = this._register(new Emitter<boolean>());
readonly onDidChangeWindowMaximized = this._onDidChangeWindowMaximized.event;
private readonly _onDidChangePanelPosition = this._register(new Emitter<string>());
readonly onDidChangePanelPosition = this._onDidChangePanelPosition.event;
private readonly _onDidChangePartVisibility = this._register(new Emitter<void>());
readonly onDidChangePartVisibility = this._onDidChangePartVisibility.event;
@@ -428,10 +425,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.setSideBarPosition(change.value as Position);
}
if (change.key === LayoutStateKeys.PANEL_POSITION) {
this.setPanelPosition(change.value as Position);
}
if (change.key === LayoutStateKeys.PANEL_ALIGNMENT) {
this.setPanelAlignment(change.value as PanelAlignment);
}
@@ -990,18 +983,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
getMaximumEditorDimensions(): Dimension {
const panelPosition = this.getPanelPosition();
const isColumn = panelPosition === Position.RIGHT || panelPosition === Position.LEFT;
const takenWidth =
(this.isVisible(Parts.ACTIVITYBAR_PART) ? this.activityBarPartView.minimumWidth : 0) +
(this.isVisible(Parts.SIDEBAR_PART) ? this.sideBarPartView.minimumWidth : 0) +
(this.isVisible(Parts.PANEL_PART) && isColumn ? this.panelPartView.minimumWidth : 0) +
(this.isVisible(Parts.AUXILIARYBAR_PART) ? this.auxiliaryBarPartView.minimumWidth : 0);
const takenHeight =
(this.isVisible(Parts.TITLEBAR_PART) ? this.titleBarPartView.minimumHeight : 0) +
(this.isVisible(Parts.STATUSBAR_PART) ? this.statusBarPartView.minimumHeight : 0) +
(this.isVisible(Parts.PANEL_PART) && !isColumn ? this.panelPartView.minimumHeight : 0);
(this.isVisible(Parts.PANEL_PART) ? this.panelPartView.minimumHeight : 0);
const availableWidth = this.dimension.width - takenWidth;
const availableHeight = this.dimension.height - takenHeight;
@@ -1224,7 +1214,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
// Panel Size
const panelSize = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN)
? this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView)
: (this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION) === Position.BOTTOM ? this.workbenchGrid.getViewSize(this.panelPartView).height : this.workbenchGrid.getViewSize(this.panelPartView).width);
: this.workbenchGrid.getViewSize(this.panelPartView).height;
this.stateModel.setInitializationValue(LayoutStateKeys.PANEL_SIZE, panelSize as number);
// Auxiliary Bar Size
@@ -1317,8 +1307,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.workbenchGrid.resizeView(this.panelPartView,
{
width: viewSize.width + (this.getPanelPosition() !== Position.BOTTOM ? sizeChangePxWidth : 0),
height: viewSize.height + (this.getPanelPosition() !== Position.BOTTOM ? 0 : sizeChangePxHeight)
width: viewSize.width,
height: viewSize.height + sizeChangePxHeight
});
break;
@@ -1500,11 +1490,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
setPanelAlignment(alignment: PanelAlignment, skipLayout?: boolean): void {
// Panel alignment only applies to a panel in the bottom position
if (this.getPanelPosition() !== Position.BOTTOM) {
return;
}
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT, alignment);
this.adjustPartPositions(this.getSideBarPosition(), alignment);
@@ -1586,23 +1571,18 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
toggleMaximizedPanel(): void {
const size = this.workbenchGrid.getViewSize(this.panelPartView);
const panelPosition = this.getPanelPosition();
const isMaximized = this.isPanelMaximized();
if (!isMaximized) {
if (this.isVisible(Parts.PANEL_PART)) {
if (panelPosition === Position.BOTTOM) {
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT, size.height);
} else {
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH, size.width);
}
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT, size.height);
}
this.setEditorHidden(true);
} else {
this.setEditorHidden(false);
this.workbenchGrid.resizeView(this.panelPartView, {
width: panelPosition === Position.BOTTOM ? size.width : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH),
height: panelPosition === Position.BOTTOM ? this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT) : size.height
width: size.width,
height: this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT)
});
}
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_WAS_LAST_MAXIMIZED, !isMaximized);
@@ -1727,62 +1707,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.configurationService.updateValue('window.menuBarVisibility', newVisibilityValue);
}
getPanelPosition(): Position {
return this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION);
}
setPanelPosition(position: Position): void {
if (!this.isVisible(Parts.PANEL_PART)) {
this.setPanelHidden(false);
}
const panelPart = this.getPart(Parts.PANEL_PART);
const oldPositionValue = positionToString(this.getPanelPosition());
const newPositionValue = positionToString(position);
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_POSITION, position);
// Adjust CSS
const panelContainer = assertIsDefined(panelPart.getContainer());
panelContainer.classList.remove(oldPositionValue);
panelContainer.classList.add(newPositionValue);
// Update Styles
panelPart.updateStyles();
// Layout
const size = this.workbenchGrid.getViewSize(this.panelPartView);
const sideBarSize = this.workbenchGrid.getViewSize(this.sideBarPartView);
const editorHidden = !this.isVisible(Parts.EDITOR_PART);
// Save last non-maximized size for panel before move
if (newPositionValue !== oldPositionValue && !editorHidden) {
// Save the current size of the panel for the new orthogonal direction
// If moving down, save the width of the panel
// Otherwise, save the height of the panel
if (position === Position.BOTTOM) {
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH, size.width);
} else if (positionFromString(oldPositionValue) === Position.BOTTOM) {
this.stateModel.setRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT, size.height);
}
}
if (position === Position.BOTTOM) {
this.workbenchGrid.moveView(this.panelPartView, editorHidden ? size.height : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_HEIGHT), this.editorPartView, Direction.Down);
} else if (position === Position.RIGHT) {
this.workbenchGrid.moveView(this.panelPartView, editorHidden ? size.width : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH), this.editorPartView, Direction.Right);
} else {
this.workbenchGrid.moveView(this.panelPartView, editorHidden ? size.width : this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_LAST_NON_MAXIMIZED_WIDTH), this.editorPartView, Direction.Left);
}
// Reset sidebar to original size before shifting the panel
this.workbenchGrid.resizeView(this.sideBarPartView, sideBarSize);
this._onDidChangePanelPosition.fire(newPositionValue);
}
isWindowMaximized() {
return this.windowState.runtime.maximized;
}
@@ -1868,64 +1792,44 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
const panelSize = this.stateModel.getInitializationValue(LayoutStateKeys.PANEL_SIZE) ? 0 : nodes.panel.size;
const result = [] as ISerializedNode[];
if (this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION) !== Position.BOTTOM) {
result.push(nodes.editor);
nodes.editor.size = availableWidth - activityBarSize - sideBarSize - panelSize - auxiliaryBarSize;
if (this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION) === Position.RIGHT) {
result.push(nodes.panel);
} else {
result.splice(0, 0, nodes.panel);
}
const panelAlignment = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT);
const sideBarPosition = this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON);
const sideBarNextToEditor = !(panelAlignment === 'center' || (sideBarPosition === Position.LEFT && panelAlignment === 'right') || (sideBarPosition === Position.RIGHT && panelAlignment === 'left'));
const auxiliaryBarNextToEditor = !(panelAlignment === 'center' || (sideBarPosition === Position.RIGHT && panelAlignment === 'right') || (sideBarPosition === Position.LEFT && panelAlignment === 'left'));
if (this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON) === Position.LEFT) {
result.push(nodes.auxiliaryBar);
result.splice(0, 0, nodes.sideBar);
result.splice(0, 0, nodes.activityBar);
} else {
result.splice(0, 0, nodes.auxiliaryBar);
result.push(nodes.sideBar);
result.push(nodes.activityBar);
}
} else {
const panelAlignment = this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_ALIGNMENT);
const sideBarPosition = this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON);
const sideBarNextToEditor = !(panelAlignment === 'center' || (sideBarPosition === Position.LEFT && panelAlignment === 'right') || (sideBarPosition === Position.RIGHT && panelAlignment === 'left'));
const auxiliaryBarNextToEditor = !(panelAlignment === 'center' || (sideBarPosition === Position.RIGHT && panelAlignment === 'right') || (sideBarPosition === Position.LEFT && panelAlignment === 'left'));
const editorSectionWidth = availableWidth - activityBarSize - (sideBarNextToEditor ? 0 : sideBarSize) - (auxiliaryBarNextToEditor ? 0 : auxiliaryBarSize);
result.push({
type: 'branch',
data: [this.arrangeEditorNodes({
editor: nodes.editor,
sideBar: sideBarNextToEditor ? nodes.sideBar : undefined,
auxiliaryBar: auxiliaryBarNextToEditor ? nodes.auxiliaryBar : undefined
}, availableHeight - panelSize, editorSectionWidth), nodes.panel],
size: editorSectionWidth
});
if (!sideBarNextToEditor) {
if (sideBarPosition === Position.LEFT) {
result.splice(0, 0, nodes.sideBar);
} else {
result.push(nodes.sideBar);
}
}
if (!auxiliaryBarNextToEditor) {
if (sideBarPosition === Position.RIGHT) {
result.splice(0, 0, nodes.auxiliaryBar);
} else {
result.push(nodes.auxiliaryBar);
}
}
const editorSectionWidth = availableWidth - activityBarSize - (sideBarNextToEditor ? 0 : sideBarSize) - (auxiliaryBarNextToEditor ? 0 : auxiliaryBarSize);
result.push({
type: 'branch',
data: [this.arrangeEditorNodes({
editor: nodes.editor,
sideBar: sideBarNextToEditor ? nodes.sideBar : undefined,
auxiliaryBar: auxiliaryBarNextToEditor ? nodes.auxiliaryBar : undefined
}, availableHeight - panelSize, editorSectionWidth), nodes.panel],
size: editorSectionWidth
});
if (!sideBarNextToEditor) {
if (sideBarPosition === Position.LEFT) {
result.splice(0, 0, nodes.activityBar);
result.splice(0, 0, nodes.sideBar);
} else {
result.push(nodes.activityBar);
result.push(nodes.sideBar);
}
}
if (!auxiliaryBarNextToEditor) {
if (sideBarPosition === Position.RIGHT) {
result.splice(0, 0, nodes.auxiliaryBar);
} else {
result.push(nodes.auxiliaryBar);
}
}
if (sideBarPosition === Position.LEFT) {
result.splice(0, 0, nodes.activityBar);
} else {
result.push(nodes.activityBar);
}
return result;
}
@@ -2027,7 +1931,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
panelVisible: boolean;
statusbarVisible: boolean;
sideBarPosition: string;
panelPosition: string;
};
type StartupLayoutEventClassification = {
@@ -2037,7 +1940,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
panelVisible: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
statusbarVisible: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
sideBarPosition: { classification: 'SystemMetaData', purpose: 'FeatureInsight'; };
panelPosition: { classification: 'SystemMetaData', purpose: 'FeatureInsight'; };
};
const layoutDescriptor: StartupLayoutEvent = {
@@ -2047,7 +1949,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
panelVisible: !this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_HIDDEN),
statusbarVisible: !this.stateModel.getRuntimeValue(LayoutStateKeys.STATUSBAR_HIDDEN),
sideBarPosition: positionToString(this.stateModel.getRuntimeValue(LayoutStateKeys.SIDEBAR_POSITON)),
panelPosition: positionToString(this.stateModel.getRuntimeValue(LayoutStateKeys.PANEL_POSITION)),
};
this.telemetryService.publicLog2<StartupLayoutEvent, StartupLayoutEventClassification>('startupLayout', layoutDescriptor);
+1 -11
View File
@@ -64,7 +64,6 @@ export const LayoutStateKeys = {
// Part Positions
SIDEBAR_POSITON: new RuntimeStateKey<Position>('sideBar.position', StorageScope.GLOBAL, StorageTarget.USER, Position.LEFT),
PANEL_POSITION: new RuntimeStateKey<Position>('panel.position', StorageScope.GLOBAL, StorageTarget.USER, Position.BOTTOM),
PANEL_ALIGNMENT: new RuntimeStateKey<PanelAlignment>('panel.alignment', StorageScope.GLOBAL, StorageTarget.USER, 'center'),
// Part Visibility
@@ -114,10 +113,6 @@ export class LayoutStateModel extends Disposable {
if (configurationChangeEvent.affectsConfiguration(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION)) {
this.setRuntimeValueAndFire(LayoutStateKeys.SIDEBAR_POSITON, positionFromString(this.configurationService.getValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION) ?? 'left'));
}
if (configurationChangeEvent.affectsConfiguration(LegacyWorkbenchLayoutSettings.PANEL_POSITION)) {
this.setRuntimeValueAndFire(LayoutStateKeys.PANEL_POSITION, positionFromString(this.configurationService.getValue(LegacyWorkbenchLayoutSettings.PANEL_POSITION) ?? 'bottom'));
}
}
private updateLegacySettingsFromState<T extends StorageKeyType>(key: RuntimeStateKey<T>, value: T): void {
@@ -134,8 +129,6 @@ export class LayoutStateModel extends Disposable {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.PANEL_ALIGNMENT, value);
} else if (key === LayoutStateKeys.SIDEBAR_POSITON) {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION, positionToString(value as Position));
} else if (key === LayoutStateKeys.PANEL_POSITION) {
this.configurationService.updateValue(LegacyWorkbenchLayoutSettings.PANEL_POSITION, positionToString(value as Position));
}
}
@@ -157,11 +150,9 @@ export class LayoutStateModel extends Disposable {
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'));
this.stateCache.set(LayoutStateKeys.PANEL_POSITION.name, positionFromString(this.configurationService.getValue(LegacyWorkbenchLayoutSettings.PANEL_POSITION) ?? 'bottom'));
// Apply sizing defaults
const workbenchDimensions = getClientArea(this.container);
const panelPosition = this.stateCache.get(LayoutStateKeys.PANEL_POSITION.name) ?? LayoutStateKeys.PANEL_POSITION.defaultValue;
const applySizingIfUndefined = <T extends StorageKeyType>(key: WorkbenchLayoutStateKey<T>, value: T) => {
if (this.stateCache.get(key.name) === undefined) {
this.stateCache.set(key.name, value);
@@ -171,7 +162,7 @@ export class LayoutStateModel extends Disposable {
applySizingIfUndefined(LayoutStateKeys.GRID_SIZE, { height: workbenchDimensions.height, width: workbenchDimensions.width });
applySizingIfUndefined(LayoutStateKeys.SIDEBAR_SIZE, Math.min(300, workbenchDimensions.width / 4));
applySizingIfUndefined(LayoutStateKeys.AUXILIARYBAR_SIZE, Math.min(300, workbenchDimensions.width / 4));
applySizingIfUndefined(LayoutStateKeys.PANEL_SIZE, panelPosition === Position.BOTTOM ? workbenchDimensions.height / 3 : workbenchDimensions.width / 4);
applySizingIfUndefined(LayoutStateKeys.PANEL_SIZE, workbenchDimensions.height / 3);
// Apply legacy settings
@@ -270,7 +261,6 @@ export enum WorkbenchLayoutSettings {
}
enum LegacyWorkbenchLayoutSettings {
PANEL_POSITION = 'workbench.panel.defaultLocation', // Deprecated to UI State
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
@@ -23,9 +23,10 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { IActivityHoverOptions } from 'vs/workbench/browser/parts/compositeBarActions';
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
import { IAction, Separator } from 'vs/base/common/actions';
import { IAction, Separator, toAction } from 'vs/base/common/actions';
import { ToggleAuxiliaryBarAction } from 'vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions';
import { assertIsDefined } from 'vs/base/common/types';
import { MoveSidePanelToPanelAction } from 'vs/workbench/browser/parts/panel/panelActions';
export class AuxiliaryBarPart extends BasePanelPart {
static readonly activePanelSettingsKey = 'workbench.auxiliarybar.activepanelid';
@@ -106,6 +107,7 @@ export class AuxiliaryBarPart extends BasePanelPart {
protected fillExtraContextMenuActions(actions: IAction[]): void {
actions.push(...[
new Separator(),
toAction({ id: MoveSidePanelToPanelAction.ID, label: localize('moveToPanel', "Move Views to Panel"), run: () => this.instantiationService.invokeFunction(accessor => new MoveSidePanelToPanelAction().run(accessor)) }),
this.instantiationService.createInstance(ToggleAuxiliaryBarAction, ToggleAuxiliaryBarAction.ID, localize('hideAuxiliaryBar', "Hide Side Panel"))
]);
}
@@ -903,7 +903,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
let lastOpenHorizontalPosition: Position | undefined;
let lastOpenVerticalPosition: Position | undefined;
const openPartAtPosition = (position: Position) => {
if (!this.layoutService.isVisible(Parts.PANEL_PART) && position === this.layoutService.getPanelPosition()) {
if (!this.layoutService.isVisible(Parts.PANEL_PART) && position === Position.BOTTOM) {
this.layoutService.setPartHidden(false, Parts.PANEL_PART);
} else if (!this.layoutService.isVisible(Parts.AUXILIARYBAR_PART) && position === (this.layoutService.getSideBarPosition() === Position.RIGHT ? Position.LEFT : Position.RIGHT)) {
this.layoutService.setPartHidden(false, Parts.AUXILIARYBAR_PART);
@@ -18,8 +18,10 @@ import { ContextKeyExpr, ContextKeyExpression } from 'vs/platform/contextkey/com
import { Codicon } from 'vs/base/common/codicons';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { ViewContainerLocationToString, ViewContainerLocation } from 'vs/workbench/common/views';
import { ViewContainerLocationToString, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { INotificationService } from 'vs/platform/notification/common/notification';
const maximizeIcon = registerIcon('panel-maximize', Codicon.chevronUp, localize('maximizeIcon', 'Icon to maximize a panel.'));
const restoreIcon = registerIcon('panel-restore', Codicon.chevronDown, localize('restoreIcon', 'Icon to restore a panel.'));
@@ -128,23 +130,68 @@ export const AlignPanelActionConfigs: PanelActionConfig<PanelAlignment>[] = [
createAlignmentPanelActionConfig(AlignPanelActionId.JUSTIFY, 'View: Justify Panel', localize('alignPanelJustify', 'Justify Panel'), localize('alignPanelJustifyShort', "Justify"), 'justify'),
];
const positionByActionId = new Map(PositionPanelActionConfigs.map(config => [config.id, config.value]));
const alignmentByActionId = new Map(AlignPanelActionConfigs.map(config => [config.id, config.value]));
export class SetPanelPositionAction extends Action {
constructor(
id: string,
label: string,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
}
PositionPanelActionConfigs.forEach(positionPanelAction => {
const { id, label } = positionPanelAction;
override async run(): Promise<void> {
const position = positionByActionId.get(this.id);
this.layoutService.setPanelPosition(position === undefined ? Position.BOTTOM : position);
}
}
registerAction2(class extends Action2 {
constructor() {
super({
id,
title: label,
category: CATEGORIES.View,
f1: true
});
}
run(accessor: ServicesAccessor): void {
const notificationService = accessor.get(INotificationService);
const commandService = accessor.get(ICommandService);
notificationService.warn(localize('deprecatedPanelMoveMessage', "Moving the panel with this command has been deprecated in favor of \"Move Views From Panel To Side Panel\" and \"Move Views From Side Panel To Panel\" for similar functionality."));
if (positionPanelAction.value === Position.BOTTOM) {
commandService.executeCommand('workbench.action.moveSidePanelToPanel');
} else {
commandService.executeCommand('workbench.action.movePanelToSidePanel');
}
}
});
});
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
submenu: MenuId.MenubarPanelAlignmentMenu,
title: localize('alignPanel', "Align Panel"),
group: '3_workbench_layout_move',
order: 5
});
AlignPanelActionConfigs.forEach(alignPanelAction => {
const { id, label, shortLabel, value, when } = alignPanelAction;
registerAction2(class extends Action2 {
constructor() {
super({
id,
title: label,
category: CATEGORIES.View,
toggled: when.negate(),
f1: true
});
}
run(accessor: ServicesAccessor): void {
const layoutService = accessor.get(IWorkbenchLayoutService);
layoutService.setPanelAlignment(value === undefined ? 'center' : value);
}
});
MenuRegistry.appendMenuItem(MenuId.MenubarPanelAlignmentMenu, {
command: {
id,
title: shortLabel,
toggled: when.negate()
},
order: 5
});
});
export class SetPanelAlignmentAction extends Action {
constructor(
@@ -365,46 +412,70 @@ MenuRegistry.appendMenuItems([
}
]);
function registerPanelActionById(config: PanelActionConfig<PanelAlignment | Position>, descriptor: SyncActionDescriptor, parentMenu: MenuId) {
const { id, label, shortLabel, alias, when } = config;
// register the workbench action
actionRegistry.registerWorkbenchAction(descriptor, alias, CATEGORIES.View.value, when);
// register as a menu item
MenuRegistry.appendMenuItems([{
id: MenuId.MenubarAppearanceMenu,
item: {
group: '3_workbench_layout_move',
command: {
id,
title: label
// --- Move Panel Views To Side Panel
export class MovePanelToSidePanelAction extends Action2 {
static readonly ID = 'workbench.action.movePanelToSidePanel';
constructor() {
super({
id: MovePanelToSidePanelAction.ID,
title: {
value: localize('movePanelToSidePanel', "Move Views From Panel To Side Panel"),
original: 'Move Views From Panel To Side Panel'
},
when,
order: 5
category: CATEGORIES.View,
f1: true,
menu: [{
id: MenuId.ViewContainerTitleContext,
group: '3_workbench_layout_move',
order: 0,
when: ContextKeyExpr.equals('viewContainerLocation', ViewContainerLocationToString(ViewContainerLocation.Panel)),
}]
});
}
run(accessor: ServicesAccessor, ...args: any[]): void {
const viewDescriptorService = accessor.get(IViewDescriptorService);
const layoutService = accessor.get(IWorkbenchLayoutService);
const panelContainers = viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.Panel);
if (panelContainers.length) {
panelContainers.forEach(viewContainer => viewDescriptorService.moveViewContainerToLocation(viewContainer, ViewContainerLocation.AuxiliaryBar));
layoutService.setPartHidden(false, Parts.AUXILIARYBAR_PART);
}
}, {
id: parentMenu,
item: {
command: {
id,
title: shortLabel,
toggled: when.negate()
},
order: 5
},
}, {
id: MenuId.ViewTitleContext,
item: {
group: '3_workbench_layout_move',
command: {
id: id,
title: label,
},
when: ContextKeyExpr.and(when, ContextKeyExpr.equals('viewLocation', ViewContainerLocationToString(ViewContainerLocation.Panel))),
order: 1
}
}]);
}
}
// register each position panel action
PositionPanelActionConfigs.forEach(config => registerPanelActionById(config, SyncActionDescriptor.create(SetPanelPositionAction, config.id, config.label), MenuId.LayoutControlPanelPositionMenu));
AlignPanelActionConfigs.forEach(config => registerPanelActionById(config, SyncActionDescriptor.create(SetPanelAlignmentAction, config.id, config.label), MenuId.LayoutControlPanelAlignmentMenu));
registerAction2(MovePanelToSidePanelAction);
// --- Move Panel Views To Side Panel
export class MoveSidePanelToPanelAction extends Action2 {
static readonly ID = 'workbench.action.moveSidePanelToPanel';
constructor() {
super({
id: MoveSidePanelToPanelAction.ID,
title: {
value: localize('moveSidePanelToPanel', "Move Views From Side Panel To Panel"),
original: 'Move Views From Side Panel To Panel'
},
category: CATEGORIES.View,
f1: true
});
}
run(accessor: ServicesAccessor, ...args: any[]): void {
const viewDescriptorService = accessor.get(IViewDescriptorService);
const layoutService = accessor.get(IWorkbenchLayoutService);
const auxiliaryBarContainers = viewDescriptorService.getViewContainersByLocation(ViewContainerLocation.AuxiliaryBar);
if (auxiliaryBarContainers.length) {
auxiliaryBarContainers.forEach(viewContainer => viewDescriptorService.moveViewContainerToLocation(viewContainer, ViewContainerLocation.Panel));
layoutService.setPartHidden(false, Parts.PANEL_PART);
}
}
}
registerAction2(MoveSidePanelToPanelAction);
@@ -12,13 +12,13 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { ActionsOrientation, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActivePanelContext, PanelFocusContext } from 'vs/workbench/common/panel';
import { CompositePart, ICompositeTitleLabel } from 'vs/workbench/browser/parts/compositePart';
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget } from 'vs/platform/storage/common/storage';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { PanelActivityAction, TogglePanelAction, PlaceHolderPanelActivityAction, PlaceHolderToggleCompositePinnedAction, PositionPanelActionConfigs, SetPanelPositionAction } from 'vs/workbench/browser/parts/panel/panelActions';
import { PanelActivityAction, TogglePanelAction, PlaceHolderPanelActivityAction, PlaceHolderToggleCompositePinnedAction, MovePanelToSidePanelAction } from 'vs/workbench/browser/parts/panel/panelActions';
import { IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { PANEL_BACKGROUND, PANEL_BORDER, PANEL_ACTIVE_TITLE_FOREGROUND, PANEL_INACTIVE_TITLE_FOREGROUND, PANEL_ACTIVE_TITLE_BORDER, PANEL_INPUT_BORDER, EDITOR_DRAG_AND_DROP_BACKGROUND, PANEL_DRAG_AND_DROP_BORDER } from 'vs/workbench/common/theme';
import { activeContrastBorder, focusBorder, contrastBorder, editorBackground, badgeBackground, badgeForeground } from 'vs/platform/theme/common/colorRegistry';
@@ -919,17 +919,15 @@ export class PanelPart extends BasePanelPart {
protected getActivityHoverOptions(): IActivityHoverOptions {
return {
position: () => this.layoutService.getPanelPosition() === Position.BOTTOM && !this.layoutService.isPanelMaximized() ? HoverPosition.ABOVE : HoverPosition.BELOW,
position: () => !this.layoutService.isPanelMaximized() ? HoverPosition.ABOVE : HoverPosition.BELOW,
};
}
protected fillExtraContextMenuActions(actions: IAction[]): void {
actions.push(...[
new Separator(),
...PositionPanelActionConfigs
// show the contextual menu item if it is not in that position
.filter(({ when }) => this.contextKeyService.contextMatchesRules(when))
.map(({ id, label }) => this.instantiationService.createInstance(SetPanelPositionAction, id, label)),
toAction({ id: MovePanelToSidePanelAction.ID, label: localize('moveToSidePanel', "Move Views to Side Panel"), run: () => this.instantiationService.invokeFunction(accessor => new MovePanelToSidePanelAction().run(accessor)) }),
this.instantiationService.createInstance(TogglePanelAction, TogglePanelAction.ID, localize('hidePanel', "Hide Panel"))
]);
}
@@ -957,12 +955,7 @@ export class PanelPart extends BasePanelPart {
}
override layout(width: number, height: number, top: number, left: number): void {
let dimensions: Dimension;
if (this.layoutService.getPanelPosition() === Position.RIGHT) {
dimensions = new Dimension(width - 1, height); // Take into account the 1px border when layouting
} else {
dimensions = new Dimension(width, height);
}
const dimensions = new Dimension(width, height);
// Layout contents
super.layout(dimensions.width, dimensions.height, top, left);
@@ -38,7 +38,7 @@ import { Component } from 'vs/workbench/common/component';
import { PANEL_SECTION_BORDER, PANEL_SECTION_DRAG_AND_DROP_BACKGROUND, PANEL_SECTION_HEADER_BACKGROUND, PANEL_SECTION_HEADER_BORDER, PANEL_SECTION_HEADER_FOREGROUND, SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER, SIDE_BAR_SECTION_HEADER_FOREGROUND } from 'vs/workbench/common/theme';
import { FocusedViewContext, IAddedViewDescriptorRef, ICustomViewDescriptor, IView, IViewContainerModel, IViewDescriptor, IViewDescriptorRef, IViewDescriptorService, IViewPaneContainer, IViewsService, ViewContainer, ViewContainerLocation, ViewContainerLocationToString, ViewVisibilityState } from 'vs/workbench/common/views';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IWorkbenchLayoutService, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
export const ViewsSubMenu = new MenuId('Views');
MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, <ISubmenuItem>{
@@ -616,7 +616,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
case ViewContainerLocation.AuxiliaryBar:
return Orientation.VERTICAL;
case ViewContainerLocation.Panel:
return this.layoutService.getPanelPosition() === Position.BOTTOM ? Orientation.HORIZONTAL : Orientation.VERTICAL;
return Orientation.HORIZONTAL;
}
return Orientation.VERTICAL;
@@ -286,7 +286,8 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
'type': 'string',
'enum': ['left', 'bottom', 'right'],
'default': 'bottom',
'description': localize('panelDefaultLocation', "Controls the default location of the panel (terminal, debug console, output, problems). It can either show at the bottom, right, or left of the workbench.")
'description': localize('panelDefaultLocation', "Controls the default location of the panel (terminal, debug console, output, problems). It can either show at the bottom, right, or left of the workbench."),
'deprecationMessage': localize('panelDefaultLocationDeprecated', "With the introduction of the side panel, the panel position is no longer able to be moved in favor of moving view containers between the panels.")
},
'workbench.panel.opensMaximized': {
'type': 'string',
+1 -1
View File
@@ -342,7 +342,7 @@ export class Workbench extends Layout {
{ id: Parts.ACTIVITYBAR_PART, role: 'none', classes: ['activitybar', this.getSideBarPosition() === Position.LEFT ? 'left' : 'right'] }, // Use role 'none' for some parts to make screen readers less chatty #114892
{ id: Parts.SIDEBAR_PART, role: 'none', classes: ['sidebar', this.getSideBarPosition() === Position.LEFT ? 'left' : 'right'] },
{ id: Parts.EDITOR_PART, role: 'main', classes: ['editor'], options: { restorePreviousState: this.willRestoreEditors() } },
{ id: Parts.PANEL_PART, role: 'none', classes: ['panel', 'basepanel', positionToString(this.getPanelPosition())] },
{ id: Parts.PANEL_PART, role: 'none', classes: ['panel', 'basepanel', positionToString(Position.BOTTOM)] },
{ id: Parts.AUXILIARYBAR_PART, role: 'none', classes: ['auxiliarybar', 'basepanel', this.getSideBarPosition() === Position.LEFT ? 'right' : 'left'] },
{ id: Parts.STATUSBAR_PART, role: 'status', classes: ['statusbar'] }
].forEach(({ id, role, classes, options }) => {
@@ -7,7 +7,7 @@ import { TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal'
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable, Disposable, DisposableStore, dispose } from 'vs/base/common/lifecycle';
import { SplitView, Orientation, IView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
import { IWorkbenchLayoutService, Parts, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITerminalInstance, Direction, ITerminalGroup, ITerminalService, ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
import { ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
@@ -244,7 +244,6 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
private _terminalInstances: ITerminalInstance[] = [];
private _splitPaneContainer: SplitPaneContainer | undefined;
private _groupElement: HTMLElement | undefined;
private _panelPosition: Position = Position.BOTTOM;
private _terminalLocation: ViewContainerLocation = ViewContainerLocation.Panel;
private _instanceDisposables: Map<number, IDisposable[]> = new Map();
@@ -273,7 +272,6 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
shellLaunchConfigOrInstance: IShellLaunchConfig | ITerminalInstance | undefined,
@ITerminalService private readonly _terminalService: ITerminalService,
@ITerminalInstanceService private readonly _terminalInstanceService: ITerminalInstanceService,
@IWorkbenchLayoutService private readonly _layoutService: IWorkbenchLayoutService,
@IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService,
@IInstantiationService private readonly _instantiationService: IInstantiationService
) {
@@ -284,7 +282,7 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
if (this._container) {
this.attachToElement(this._container);
}
this._onPanelOrientationChanged.fire(this._terminalLocation === ViewContainerLocation.Panel && this._panelPosition === Position.BOTTOM ? Orientation.HORIZONTAL : Orientation.VERTICAL);
this._onPanelOrientationChanged.fire(this._terminalLocation === ViewContainerLocation.Panel ? Orientation.HORIZONTAL : Orientation.VERTICAL);
}
addInstance(shellLaunchConfigOrInstance: IShellLaunchConfig | ITerminalInstance, parentTerminalId?: number): void {
@@ -462,9 +460,8 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
this._container.appendChild(this._groupElement);
if (!this._splitPaneContainer) {
this._panelPosition = this._layoutService.getPanelPosition();
this._terminalLocation = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID)!;
const orientation = this._terminalLocation === ViewContainerLocation.Panel && this._panelPosition === Position.BOTTOM ? Orientation.HORIZONTAL : Orientation.VERTICAL;
const orientation = this._terminalLocation === ViewContainerLocation.Panel ? Orientation.HORIZONTAL : Orientation.VERTICAL;
this._splitPaneContainer = this._instantiationService.createInstance(SplitPaneContainer, this._groupElement, orientation);
this.terminalInstances.forEach(instance => this._splitPaneContainer!.split(instance, this._activeInstanceIndex + 1));
if (this._initialRelativeSizes) {
@@ -526,13 +523,11 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
layout(width: number, height: number): void {
if (this._splitPaneContainer) {
// Check if the panel position changed and rotate panes if so
const newPanelPosition = this._layoutService.getPanelPosition();
const newTerminalLocation = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID)!;
const terminalPositionChanged = newPanelPosition !== this._panelPosition || newTerminalLocation !== this._terminalLocation;
const terminalPositionChanged = newTerminalLocation !== this._terminalLocation;
if (terminalPositionChanged) {
const newOrientation = newTerminalLocation === ViewContainerLocation.Panel && newPanelPosition === Position.BOTTOM ? Orientation.HORIZONTAL : Orientation.VERTICAL;
const newOrientation = newTerminalLocation === ViewContainerLocation.Panel ? Orientation.HORIZONTAL : Orientation.VERTICAL;
this._splitPaneContainer.setOrientation(newOrientation);
this._panelPosition = newPanelPosition;
this._terminalLocation = newTerminalLocation;
this._onPanelOrientationChanged.fire(this._splitPaneContainer.orientation);
}
@@ -51,7 +51,6 @@ import { URI } from 'vs/base/common/uri';
import { DataTransfers } from 'vs/base/browser/dnd';
import { CodeDataTransfers, containsDragType, DragAndDropObserver, IDragAndDropObserverCallbacks } from 'vs/workbench/browser/dnd';
import { getColorClass, getColorStyleElement, getStandardColors } from 'vs/workbench/contrib/terminal/browser/terminalIcon';
import { IWorkbenchLayoutService, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
@@ -2041,7 +2040,6 @@ class TerminalInstanceDragAndDropController extends Disposable implements IDragA
constructor(
private readonly _container: HTMLElement,
@IWorkbenchLayoutService private readonly _layoutService: IWorkbenchLayoutService,
@IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService,
) {
super();
@@ -2152,9 +2150,8 @@ class TerminalInstanceDragAndDropController extends Disposable implements IDragA
}
private _getViewOrientation(): Orientation {
const panelPosition = this._layoutService.getPanelPosition();
const terminalLocation = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID);
return terminalLocation === ViewContainerLocation.Panel && panelPosition === Position.BOTTOM
return terminalLocation === ViewContainerLocation.Panel
? Orientation.HORIZONTAL
: Orientation.VERTICAL;
}
+2 -23
View File
@@ -13,7 +13,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { EditorResourceAccessor, IUntitledTextResourceEditorInput, SideBySideEditor, pathsToEditors, IResourceDiffEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { WindowMinimumSize, IOpenFileRequest, IWindowsConfiguration, getTitleBarStyle, IAddFoldersRequest, INativeRunActionInWindowRequest, INativeRunKeybindingInWindowRequest, INativeOpenFileRequest } from 'vs/platform/windows/common/windows';
import { IOpenFileRequest, IWindowsConfiguration, getTitleBarStyle, IAddFoldersRequest, INativeRunActionInWindowRequest, INativeRunKeybindingInWindowRequest, INativeOpenFileRequest } from 'vs/platform/windows/common/windows';
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { applyZoom } from 'vs/platform/windows/electron-sandbox/window';
@@ -47,7 +47,7 @@ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
import { posix, dirname } from 'vs/base/common/path';
import { getBaseLabel } from 'vs/base/common/labels';
import { ITunnelService, extractLocalHostUriMetaDataForPortMapping } from 'vs/platform/remote/common/tunnel';
import { IWorkbenchLayoutService, Parts, positionFromString, Position } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopy';
import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
@@ -312,10 +312,6 @@ export class NativeWindow extends Disposable {
this.onDidChangeWindowMaximized(this.environmentService.configuration.maximized ?? false);
// Detect panel position to determine minimum width
this._register(this.layoutService.onDidChangePanelPosition(pos => this.onDidChangePanelPosition(positionFromString(pos))));
this.onDidChangePanelPosition(this.layoutService.getPanelPosition());
// Lifecycle
this._register(this.lifecycleService.onBeforeShutdownError(e => this.onBeforeShutdownError(e)));
this._register(this.lifecycleService.onWillShutdown((e) => this.onWillShutdown(e)));
@@ -401,23 +397,6 @@ export class NativeWindow extends Disposable {
this.layoutService.updateWindowMaximizedState(maximized);
}
private getWindowMinimumWidth(panelPosition: Position = this.layoutService.getPanelPosition()): number {
// if panel is on the side, then return the larger minwidth
const panelOnSide = panelPosition === Position.LEFT || panelPosition === Position.RIGHT;
if (panelOnSide) {
return WindowMinimumSize.WIDTH_WITH_VERTICAL_PANEL;
}
return WindowMinimumSize.WIDTH;
}
private onDidChangePanelPosition(pos: Position): void {
const minWidth = this.getWindowMinimumWidth(pos);
this.nativeHostService.setMinimumSize(minWidth, undefined);
}
private onDidChangeVisibleEditors(): void {
// Close when empty: check if we should close the window based on the setting
@@ -99,11 +99,6 @@ export interface IWorkbenchLayoutService extends ILayoutService {
*/
readonly onDidChangeCenteredLayout: Event<boolean>;
/**
* Emit when panel position changes.
*/
readonly onDidChangePanelPosition: Event<string>;
/**
* Emit when part visibility changes
*/
@@ -201,16 +196,6 @@ export interface IWorkbenchLayoutService extends ILayoutService {
*/
toggleMenuBar(): void;
/**
* Gets the current panel position. Note that the panel can be hidden too.
*/
getPanelPosition(): Position;
/**
* Sets the panel position.
*/
setPanelPosition(position: Position): void;
/**
* Sets the panel alignment.
*/