Merge pull request #13883 from Microsoft/ben/horizontal

Diagonal editor layout
This commit is contained in:
Benjamin Pasero
2016-10-18 10:53:07 +02:00
committed by GitHub
40 changed files with 947 additions and 696 deletions
+18 -8
View File
@@ -72,9 +72,6 @@ export class Sash extends EventEmitter {
this.$e.on(DOM.EventType.DBLCLICK, (e: MouseEvent) => { this.emit('reset', e); });
this.$e.on(EventType.Start, (e: GestureEvent) => { this.onTouchStart(e); });
this.orientation = options.orientation || Orientation.VERTICAL;
this.$e.addClass(this.getOrientation());
this.size = options.baseSize || 5;
if (isIPad) {
@@ -82,11 +79,7 @@ export class Sash extends EventEmitter {
this.$e.addClass('touch');
}
if (this.orientation === Orientation.HORIZONTAL) {
this.$e.size(null, this.size);
} else {
this.$e.size(this.size);
}
this.setOrientation(options.orientation || Orientation.VERTICAL);
this.isDisabled = false;
this.hidden = false;
@@ -97,6 +90,23 @@ export class Sash extends EventEmitter {
return this.$e.getHTMLElement();
}
public setOrientation(orientation: Orientation): void {
this.orientation = orientation;
this.$e.removeClass('horizontal', 'vertical');
this.$e.addClass(this.getOrientation());
if (this.orientation === Orientation.HORIZONTAL) {
this.$e.size(null, this.size);
} else {
this.$e.size(this.size);
}
if (this.layoutProvider) {
this.layout();
}
}
private getOrientation(): 'horizontal' | 'vertical' {
return this.orientation === Orientation.HORIZONTAL ? 'horizontal' : 'vertical';
}
+5 -3
View File
@@ -487,6 +487,7 @@ export class VSCodeMenu {
const fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsService.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsService.getWindowCount() > 0 });
const toggleMenuBar = this.createMenuItem(nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar"), 'workbench.action.toggleMenuBar');
const splitEditor = this.createMenuItem(nls.localize({ key: 'miSplitEditor', comment: ['&& denotes a mnemonic'] }, "Split &&Editor"), 'workbench.action.splitEditor');
const toggleEditorLayout = this.createMenuItem(nls.localize({ key: 'miToggleEditorLayout', comment: ['&& denotes a mnemonic'] }, "Toggle Editor &&Layout"), 'workbench.action.toggleEditorLayout');
const toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility');
const moveSidebar = this.createMenuItem(nls.localize({ key: 'miMoveSidebar', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar"), 'workbench.action.toggleSidebarPosition');
const togglePanel = this.createMenuItem(nls.localize({ key: 'miTogglePanel', comment: ['&& denotes a mnemonic'] }, "Toggle &&Panel"), 'workbench.action.togglePanel');
@@ -519,6 +520,7 @@ export class VSCodeMenu {
platform.isWindows || platform.isLinux ? toggleMenuBar : void 0,
__separator__(),
splitEditor,
toggleEditorLayout,
moveSidebar,
toggleSidebar,
togglePanel,
@@ -557,9 +559,9 @@ export class VSCodeMenu {
const switchGroupMenu = new Menu();
const focusFirstGroup = this.createMenuItem(nls.localize({ key: 'miFocusFirstGroup', comment: ['&& denotes a mnemonic'] }, "&&Left Group"), 'workbench.action.focusFirstEditorGroup');
const focusSecondGroup = this.createMenuItem(nls.localize({ key: 'miFocusSecondGroup', comment: ['&& denotes a mnemonic'] }, "&&Center Group"), 'workbench.action.focusSecondEditorGroup');
const focusThirdGroup = this.createMenuItem(nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "&&Right Group"), 'workbench.action.focusThirdEditorGroup');
const focusFirstGroup = this.createMenuItem(nls.localize({ key: 'miFocusFirstGroup', comment: ['&& denotes a mnemonic'] }, "&&First Group"), 'workbench.action.focusFirstEditorGroup');
const focusSecondGroup = this.createMenuItem(nls.localize({ key: 'miFocusSecondGroup', comment: ['&& denotes a mnemonic'] }, "&&Second Group"), 'workbench.action.focusSecondEditorGroup');
const focusThirdGroup = this.createMenuItem(nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "&&Third Group"), 'workbench.action.focusThirdEditorGroup');
const nextGroup = this.createMenuItem(nls.localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group"), 'workbench.action.focusNextGroup');
const previousGroup = this.createMenuItem(nls.localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group"), 'workbench.action.focusPreviousGroup');
+7 -7
View File
@@ -111,17 +111,17 @@ export interface IEditor {
*/
export enum Position {
/** Opens the editor in the LEFT most position replacing the input currently showing */
LEFT = 0,
/** Opens the editor in the first position replacing the input currently showing */
ONE = 0,
/** Opens the editor in the CENTER position replacing the input currently showing */
CENTER = 1,
/** Opens the editor in the second position replacing the input currently showing */
TWO = 1,
/** Opens the editor in the RIGHT most position replacing the input currently showing */
RIGHT = 2
/** Opens the editor in the third most position replacing the input currently showing */
THREE = 2
}
export const POSITIONS = [Position.LEFT, Position.CENTER, Position.RIGHT];
export const POSITIONS = [Position.ONE, Position.TWO, Position.THREE];
export enum Direction {
LEFT,
@@ -102,13 +102,13 @@ export function toDiagnosticSeverty(value: Severity): types.DiagnosticSeverity {
}
export function fromViewColumn(column?: vscode.ViewColumn): EditorPosition {
let editorColumn = EditorPosition.LEFT;
let editorColumn = EditorPosition.ONE;
if (typeof column !== 'number') {
// stick with LEFT
// stick with ONE
} else if (column === <number>types.ViewColumn.Two) {
editorColumn = EditorPosition.CENTER;
editorColumn = EditorPosition.TWO;
} else if (column === <number>types.ViewColumn.Three) {
editorColumn = EditorPosition.RIGHT;
editorColumn = EditorPosition.THREE;
}
return editorColumn;
}
@@ -117,11 +117,11 @@ export function toViewColumn(position?: EditorPosition): vscode.ViewColumn {
if (typeof position !== 'number') {
return;
}
if (position === EditorPosition.LEFT) {
if (position === EditorPosition.ONE) {
return <number>types.ViewColumn.One;
} else if (position === EditorPosition.CENTER) {
} else if (position === EditorPosition.TWO) {
return <number>types.ViewColumn.Two;
} else if (position === EditorPosition.RIGHT) {
} else if (position === EditorPosition.THREE) {
return <number>types.ViewColumn.Three;
}
}
@@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench .toggle-editor-layout {
background-image: url('editor-layout.svg');
}
.vs-dark .monaco-workbench .toggle-editor-layout,
.hc-black .monaco-workbench .toggle-editor-layout {
background-image: url('editor-layout-inverse.svg');
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}.icon-vs-fg{fill:#2b282e}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M0 16V0h11v6h5v10H0z" id="outline" style="display: none;"/><path class="icon-vs-fg" d="M4 14H2V4h7v3H4v7zm10 0H5v-4h9v4z" id="iconFg" style="display: none;"/><path class="icon-vs-bg" d="M10 7V1H1v14h14V7h-5zm-6 7H2V4h7v3H4v7zm10 0H5v-4h9v4z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 562 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}.icon-vs-fg{fill:#f0eff1}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M0 16V0h11v6h5v10H0z" id="outline" style="display: none;"/><path class="icon-vs-fg" d="M4 14H2V4h7v3H4v7zm10 0H5v-4h9v4z" id="iconFg" style="display: none;"/><path class="icon-vs-bg" d="M10 7V1H1v14h14V7h-5zm-6 7H2V4h7v3H4v7zm10 0H5v-4h9v4z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 562 B

@@ -74,12 +74,12 @@ export class BaseTwoEditorsAction extends Action {
return this.createIfNotExists(editableResource, defaultEditableContents).then(() => {
return this.editorService.createInput({ resource: editableResource }).then(typedRightHandEditableInput => {
const editors = [
{ input: leftHandDefaultInput, position: Position.LEFT, options: { pinned: true } },
{ input: typedRightHandEditableInput, position: Position.CENTER, options: { pinned: true } }
{ input: leftHandDefaultInput, position: Position.ONE, options: { pinned: true } },
{ input: typedRightHandEditableInput, position: Position.TWO, options: { pinned: true } }
];
return this.editorService.openEditors(editors).then(() => {
this.editorGroupService.focusGroup(Position.CENTER);
this.editorGroupService.focusGroup(Position.TWO);
});
});
});
@@ -153,7 +153,7 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction {
const editorCount = this.editorService.getVisibleEditors().length;
return this.editorService.createInput({ resource: this.contextService.toResource(WORKSPACE_CONFIG_DEFAULT_PATH) }).then(typedInput => {
return this.editorService.openEditor(typedInput, { pinned: true }, editorCount === 2 ? Position.RIGHT : editorCount === 1 ? Position.CENTER : void 0);
return this.editorService.openEditor(typedInput, { pinned: true }, editorCount === 2 ? Position.THREE : editorCount === 1 ? Position.TWO : void 0);
});
}),
new Action('neverShowAgain', nls.localize('neverShowAgain', "Don't show again"), null, true, () => {
@@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./media/actions';
import { TPromise } from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class ToggleEditorLayoutAction extends Action {
public static ID = 'workbench.action.toggleEditorLayout';
public static LABEL = nls.localize('toggleEditorLayout', "Toggle Editor Layout");
private static editorLayoutConfigurationKey = 'workbench.editor.sideBySideLayout';
constructor(
id: string,
label: string,
@IMessageService private messageService: IMessageService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationEditingService private configurationEditingService: IConfigurationEditingService
) {
super(id, label);
this.class = 'toggle-editor-layout';
}
public run(): TPromise<any> {
const editorLayoutVertical = this.configurationService.lookup('workbench.editor.sideBySideLayout').value !== 'horizontal';
const newEditorLayout = editorLayoutVertical ? 'horizontal' : 'vertical';
this.configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: ToggleEditorLayoutAction.editorLayoutConfigurationKey, value: newEditorLayout }).then(null, error => {
this.messageService.show(Severity.Error, error);
});
return TPromise.as(null);
}
}
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleEditorLayoutAction, ToggleEditorLayoutAction.ID, ToggleEditorLayoutAction.LABEL), 'View: Toggle Editor Layout', nls.localize('view', "View"));
+1 -1
View File
@@ -20,7 +20,7 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer
const DEFAULT_MIN_PART_WIDTH = 170;
const DEFAULT_MIN_PANEL_PART_HEIGHT = 77;
const DEFAULT_MIN_EDITOR_PART_HEIGHT = 170;
const DEFAULT_MIN_EDITOR_PART_HEIGHT = 210; /* 3 x 70px min height of editors when stacked vertically */
const HIDE_SIDEBAR_WIDTH_THRESHOLD = 50;
const HIDE_PANEL_HEIGHT_THRESHOLD = 50;
@@ -334,7 +334,7 @@ export interface IEditorInputActionContext {
*/
export class EditorInputActionContributor extends ActionBarContributor {
// The following data structures are partitioned into arrays of Position (left, center, right)
// The following data structures are partitioned into arrays of Position (one, two, three)
private mapEditorInputActionContextToPrimaryActions: { [id: string]: IEditorInputAction[] }[];
private mapEditorInputActionContextToSecondaryActions: { [id: string]: IEditorInputAction[] }[];
@@ -30,10 +30,10 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import {
CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction,
NavigateBetweenGroupsAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, ShowEditorsInLeftGroupAction,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, ReopenClosedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, NAVIGATE_IN_LEFT_GROUP_PREFIX,
OpenPreviousEditorFromHistoryAction, ShowAllEditorsAction, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, ClearEditorHistoryAction, ShowEditorsInCenterGroupAction, MoveEditorRightInGroupAction,
NAVIGATE_IN_CENTER_GROUP_PREFIX, ShowEditorsInRightGroupAction, NAVIGATE_IN_RIGHT_GROUP_PREFIX, FocusLastEditorInStackAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToLeftGroupAction, MoveEditorToRightGroupAction, MoveEditorLeftInGroupAction
NavigateBetweenGroupsAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, ShowEditorsInGroupOneAction,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, ReopenClosedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, NAVIGATE_IN_GROUP_ONE_PREFIX,
OpenPreviousEditorFromHistoryAction, ShowAllEditorsAction, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, ClearEditorHistoryAction, ShowEditorsInGroupTwoAction, MoveEditorRightInGroupAction,
NAVIGATE_IN_GROUP_TWO_PREFIX, ShowEditorsInGroupThreeAction, NAVIGATE_IN_GROUP_THREE_PREFIX, FocusLastEditorInStackAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction, MoveEditorToNextGroupAction, MoveEditorLeftInGroupAction
} from 'vs/workbench/browser/parts/editor/editorActions';
import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands';
@@ -108,6 +108,8 @@ export class QuickOpenActionContributor extends ActionBarContributor {
if (entry) {
if (!this.openToSideActionInstance) {
this.openToSideActionInstance = this.instantiationService.createInstance(OpenToSideAction);
} else {
this.openToSideActionInstance.updateClass();
}
actions.push(this.openToSideActionInstance);
@@ -131,13 +133,13 @@ actionBarRegistry.registerActionBarContributor(Scope.VIEWER, QuickOpenActionCont
Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpenHandler(
new QuickOpenHandlerDescriptor(
'vs/workbench/browser/parts/editor/editorPicker',
'LeftEditorGroupPicker',
NAVIGATE_IN_LEFT_GROUP_PREFIX,
'GroupOnePicker',
NAVIGATE_IN_GROUP_ONE_PREFIX,
[
{
prefix: NAVIGATE_IN_LEFT_GROUP_PREFIX,
prefix: NAVIGATE_IN_GROUP_ONE_PREFIX,
needsEditor: false,
description: nls.localize('leftEditorGroupPicker', "Show Editors in Left Group")
description: nls.localize('groupOnePicker', "Show Editors in First Group")
}
]
)
@@ -146,13 +148,13 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpenHandler(
new QuickOpenHandlerDescriptor(
'vs/workbench/browser/parts/editor/editorPicker',
'CenterEditorGroupPicker',
NAVIGATE_IN_CENTER_GROUP_PREFIX,
'GroupTwoPicker',
NAVIGATE_IN_GROUP_TWO_PREFIX,
[
{
prefix: NAVIGATE_IN_CENTER_GROUP_PREFIX,
prefix: NAVIGATE_IN_GROUP_TWO_PREFIX,
needsEditor: false,
description: nls.localize('centerEditorGroupPicker', "Show Editors in Center Group")
description: nls.localize('groupTwoPicker', "Show Editors in Second Group")
}
]
)
@@ -161,13 +163,13 @@ Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpen
Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen).registerQuickOpenHandler(
new QuickOpenHandlerDescriptor(
'vs/workbench/browser/parts/editor/editorPicker',
'RightEditorGroupPicker',
NAVIGATE_IN_RIGHT_GROUP_PREFIX,
'GroupThreePicker',
NAVIGATE_IN_GROUP_THREE_PREFIX,
[
{
prefix: NAVIGATE_IN_RIGHT_GROUP_PREFIX,
prefix: NAVIGATE_IN_GROUP_THREE_PREFIX,
needsEditor: false,
description: nls.localize('rightEditorGroupPicker', "Show Editors in Right Group")
description: nls.localize('groupThreePicker', "Show Editors in Third Group")
}
]
)
@@ -193,9 +195,9 @@ const category = nls.localize('view', "View");
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextRecentlyUsedEditorInGroupAction, OpenNextRecentlyUsedEditorInGroupAction.ID, OpenNextRecentlyUsedEditorInGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.Tab, mac: { primary: KeyMod.WinCtrl | KeyCode.Tab } }), 'Open Next Recently Used Editor in Group');
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditorInGroupAction.ID, OpenPreviousRecentlyUsedEditorInGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Tab, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.Tab } }), 'Open Previous Recently Used Editor in Group');
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowAllEditorsAction, ShowAllEditorsAction.ID, ShowAllEditorsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_P), mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Tab } }), 'View: Show All Editors', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInLeftGroupAction, ShowEditorsInLeftGroupAction.ID, ShowEditorsInLeftGroupAction.LABEL), 'View: Show Editors in Left Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInCenterGroupAction, ShowEditorsInCenterGroupAction.ID, ShowEditorsInCenterGroupAction.LABEL), 'View: Show Editors in Center Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInRightGroupAction, ShowEditorsInRightGroupAction.ID, ShowEditorsInRightGroupAction.LABEL), 'View: Show Editors in Left Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInGroupOneAction, ShowEditorsInGroupOneAction.ID, ShowEditorsInGroupOneAction.LABEL), 'View: Show Editors in First Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInGroupTwoAction, ShowEditorsInGroupTwoAction.ID, ShowEditorsInGroupTwoAction.LABEL), 'View: Show Editors in Second Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInGroupThreeAction, ShowEditorsInGroupThreeAction.ID, ShowEditorsInGroupThreeAction.LABEL), 'View: Show Editors in Third Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditor, OpenNextEditor.ID, OpenNextEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageDown, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow } }), 'View: Open Next Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditor, OpenPreviousEditor.ID, OpenPreviousEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageUp, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow } }), 'View: Open Previous Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ReopenClosedEditorAction, ReopenClosedEditorAction.ID, ReopenClosedEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_T }), 'View: Reopen Closed Editor', category);
@@ -209,9 +211,9 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(CloseEditorsInOtherGro
registry.registerWorkbenchAction(new SyncActionDescriptor(SplitEditorAction, SplitEditorAction.ID, SplitEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_BACKSLASH }), 'View: Split Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateBetweenGroupsAction, NavigateBetweenGroupsAction.ID, NavigateBetweenGroupsAction.LABEL), 'View: Navigate Between Editor Groups', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusActiveGroupAction, FocusActiveGroupAction.ID, FocusActiveGroupAction.LABEL), 'View: Focus Active Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusFirstGroupAction, FocusFirstGroupAction.ID, FocusFirstGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_1 }), 'View: Focus Left Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusSecondGroupAction, FocusSecondGroupAction.ID, FocusSecondGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_2 }), 'View: Focus Center Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusThirdGroupAction, FocusThirdGroupAction.ID, FocusThirdGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_3 }), 'View: Focus Right Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusFirstGroupAction, FocusFirstGroupAction.ID, FocusFirstGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_1 }), 'View: Focus First Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusSecondGroupAction, FocusSecondGroupAction.ID, FocusSecondGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_2 }), 'View: Focus Second Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusThirdGroupAction, FocusThirdGroupAction.ID, FocusThirdGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_3 }), 'View: Focus Third Editor Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusLastEditorInStackAction, FocusLastEditorInStackAction.ID, FocusLastEditorInStackAction.LABEL, { primary: KeyMod.Alt | KeyCode.KEY_0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_0 } }), 'View: Focus Last Editor in Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(EvenGroupWidthsAction, EvenGroupWidthsAction.ID, EvenGroupWidthsAction.LABEL), 'View: Even Editor Group Widths', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MaximizeGroupAction, MaximizeGroupAction.ID, MaximizeGroupAction.LABEL), 'View: Maximize Editor Group and Hide Sidebar', category);
@@ -220,8 +222,8 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorLeftInGroupA
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorRightInGroupAction, MoveEditorRightInGroupAction.ID, MoveEditorRightInGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.PageDown, mac: { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow) } }), 'View: Move Editor Right', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveGroupLeftAction, MoveGroupLeftAction.ID, MoveGroupLeftAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.LeftArrow) }), 'View: Move Editor Group Left', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveGroupRightAction, MoveGroupRightAction.ID, MoveGroupRightAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.RightArrow) }), 'View: Move Editor Group Right', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorToLeftGroupAction, MoveEditorToLeftGroupAction.ID, MoveEditorToLeftGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.LeftArrow } }), 'View: Move Editor into Group to the Left', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorToRightGroupAction, MoveEditorToRightGroupAction.ID, MoveEditorToRightGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.RightArrow } }), 'View: Move Editor into Group to the Right', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorToPreviousGroupAction, MoveEditorToPreviousGroupAction.ID, MoveEditorToPreviousGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.LeftArrow } }), 'View: Move Editor into Previous Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(MoveEditorToNextGroupAction, MoveEditorToNextGroupAction.ID, MoveEditorToNextGroupAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.RightArrow } }), 'View: Move Editor into Next Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousGroup, FocusPreviousGroup.ID, FocusPreviousGroup.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.LeftArrow) }), 'View: Focus Previous Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(FocusNextGroup, FocusNextGroup.ID, FocusNextGroup.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.RightArrow) }), 'View: Focus Next Group', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(NavigateForwardAction, NavigateForwardAction.ID, NavigateForwardAction.LABEL, { primary: null, win: { primary: KeyMod.Alt | KeyCode.RightArrow }, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.US_MINUS }, linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_MINUS } }), 'Go Forward');
@@ -16,6 +16,7 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
import { Position, IEditor, Direction, IResourceInput, IEditorInput } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorGroupService, GroupArrangement } from 'vs/workbench/services/group/common/groupService';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
@@ -70,26 +71,26 @@ export class SplitEditorAction extends Action {
switch (editorCount) {
// Open split editor to the right of left one
// Open split editor to the right/bottom of left/top one
case 1:
targetPosition = Position.CENTER;
targetPosition = Position.TWO;
break;
// Special case two editors opened
case 2:
// Continue splitting to the right
if (editorToSplit.position === Position.CENTER) {
targetPosition = Position.RIGHT;
// Continue splitting to the right/bottom
if (editorToSplit.position === Position.TWO) {
targetPosition = Position.THREE;
}
// Push the center group to the right to make room for the splitted input
else if (editorToSplit.position === Position.LEFT) {
// Push the second group to the right/bottom to make room for the splitted input
else if (editorToSplit.position === Position.ONE) {
options.preserveFocus = true;
return this.editorService.openEditor(editorToSplit.input, options, Position.RIGHT).then(() => {
this.editorGroupService.moveGroup(Position.RIGHT, Position.CENTER);
this.editorGroupService.focusGroup(Position.CENTER);
return this.editorService.openEditor(editorToSplit.input, options, Position.THREE).then(() => {
this.editorGroupService.moveGroup(Position.THREE, Position.TWO);
this.editorGroupService.focusGroup(Position.TWO);
});
}
}
@@ -125,7 +126,7 @@ export class NavigateBetweenGroupsAction extends Action {
return TPromise.as(false);
}
// Cycle to the left and use module to start at 0 again
// Cycle to the left/top and use module to start at 0 again
const visibleEditors = this.editorService.getVisibleEditors();
const editorCount = visibleEditors.length;
const newIndex = (activeEditor.position + 1) % editorCount;
@@ -162,7 +163,7 @@ export class FocusActiveGroupAction extends Action {
export class FocusFirstGroupAction extends Action {
public static ID = 'workbench.action.focusFirstEditorGroup';
public static LABEL = nls.localize('focusFirstEditorGroup', "Focus Left Editor Group");
public static LABEL = nls.localize('focusFirstEditorGroup', "Focus First Editor Group");
constructor(
id: string,
@@ -176,11 +177,11 @@ export class FocusFirstGroupAction extends Action {
public run(): TPromise<any> {
// Find left editor and focus it
// Find left/top editor and focus it
const editors = this.editorService.getVisibleEditors();
for (let editor of editors) {
if (editor.position === Position.LEFT) {
this.editorGroupService.focusGroup(Position.LEFT);
if (editor.position === Position.ONE) {
this.editorGroupService.focusGroup(Position.ONE);
return TPromise.as(true);
}
@@ -193,10 +194,10 @@ export class FocusFirstGroupAction extends Action {
// For now only support to open files from history to the side
if (input instanceof EditorInput) {
if (!!getUntitledOrFileResource(input)) {
return this.editorService.openEditor(input, null, Position.LEFT);
return this.editorService.openEditor(input, null, Position.ONE);
}
} else {
return this.editorService.openEditor(input as IResourceInput, Position.LEFT);
return this.editorService.openEditor(input as IResourceInput, Position.ONE);
}
}
@@ -280,7 +281,7 @@ export abstract class BaseFocusSideGroupAction extends Action {
export class FocusSecondGroupAction extends BaseFocusSideGroupAction {
public static ID = 'workbench.action.focusSecondEditorGroup';
public static LABEL = nls.localize('focusSecondEditorGroup', "Focus Center Editor Group");
public static LABEL = nls.localize('focusSecondEditorGroup', "Focus Second Editor Group");
constructor(
id: string,
@@ -293,18 +294,18 @@ export class FocusSecondGroupAction extends BaseFocusSideGroupAction {
}
protected getReferenceEditorSide(): Position {
return Position.LEFT;
return Position.ONE;
}
protected getTargetEditorSide(): Position {
return Position.CENTER;
return Position.TWO;
}
}
export class FocusThirdGroupAction extends BaseFocusSideGroupAction {
public static ID = 'workbench.action.focusThirdEditorGroup';
public static LABEL = nls.localize('focusThirdEditorGroup', "Focus Right Editor Group");
public static LABEL = nls.localize('focusThirdEditorGroup', "Focus Third Editor Group");
constructor(
id: string,
@@ -317,11 +318,11 @@ export class FocusThirdGroupAction extends BaseFocusSideGroupAction {
}
protected getReferenceEditorSide(): Position {
return Position.CENTER;
return Position.TWO;
}
protected getTargetEditorSide(): Position {
return Position.RIGHT;
return Position.THREE;
}
}
@@ -348,10 +349,10 @@ export class FocusPreviousGroup extends Action {
}
// Find the next position to the left
let nextPosition: Position = Position.LEFT;
if (activeEditor.position === Position.RIGHT) {
nextPosition = Position.CENTER;
// Find the next position to the left/top
let nextPosition: Position = Position.ONE;
if (activeEditor.position === Position.THREE) {
nextPosition = Position.TWO;
}
// Focus next position if provided
@@ -377,22 +378,22 @@ export class FocusNextGroup extends Action {
super(id, label);
this.navigateActions = [];
this.navigateActions[Position.LEFT] = instantiationService.createInstance(FocusFirstGroupAction, FocusFirstGroupAction.ID, FocusFirstGroupAction.LABEL);
this.navigateActions[Position.CENTER] = instantiationService.createInstance(FocusSecondGroupAction, FocusSecondGroupAction.ID, FocusSecondGroupAction.LABEL);
this.navigateActions[Position.RIGHT] = instantiationService.createInstance(FocusThirdGroupAction, FocusThirdGroupAction.ID, FocusThirdGroupAction.LABEL);
this.navigateActions[Position.ONE] = instantiationService.createInstance(FocusFirstGroupAction, FocusFirstGroupAction.ID, FocusFirstGroupAction.LABEL);
this.navigateActions[Position.TWO] = instantiationService.createInstance(FocusSecondGroupAction, FocusSecondGroupAction.ID, FocusSecondGroupAction.LABEL);
this.navigateActions[Position.THREE] = instantiationService.createInstance(FocusThirdGroupAction, FocusThirdGroupAction.ID, FocusThirdGroupAction.LABEL);
}
public run(event?: any): TPromise<any> {
// Find the next position to the right to use
// Find the next position to the right/bottom to use
let nextPosition: Position;
const activeEditor = this.editorService.getActiveEditor();
if (!activeEditor) {
nextPosition = Position.LEFT;
} else if (activeEditor.position === Position.LEFT) {
nextPosition = Position.CENTER;
} else if (activeEditor.position === Position.CENTER) {
nextPosition = Position.RIGHT;
nextPosition = Position.ONE;
} else if (activeEditor.position === Position.ONE) {
nextPosition = Position.TWO;
} else if (activeEditor.position === Position.TWO) {
nextPosition = Position.THREE;
}
// Run the action for the target next position
@@ -409,17 +410,25 @@ export class OpenToSideAction extends Action {
public static OPEN_TO_SIDE_ID = 'workbench.action.openToSide';
public static OPEN_TO_SIDE_LABEL = nls.localize('openToSide', "Open to the Side");
constructor( @IWorkbenchEditorService private editorService: IWorkbenchEditorService) {
constructor(
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IConfigurationService private configurationService: IConfigurationService
) {
super(OpenToSideAction.OPEN_TO_SIDE_ID, OpenToSideAction.OPEN_TO_SIDE_LABEL);
this.class = 'quick-open-sidebyside';
this.updateEnablement();
this.updateClass();
}
public updateClass(): void {
const editorLayoutVertical = this.configurationService.lookup('workbench.editor.sideBySideLayout').value !== 'horizontal';
this.class = editorLayoutVertical ? 'quick-open-sidebyside-vertical' : 'quick-open-sidebyside-horizontal';
}
private updateEnablement(): void {
const activeEditor = this.editorService.getActiveEditor();
this.enabled = (!activeEditor || activeEditor.position !== Position.RIGHT);
this.enabled = (!activeEditor || activeEditor.position !== Position.THREE);
}
public run(context: any): TPromise<any> {
@@ -676,13 +685,13 @@ export class MoveGroupLeftAction extends Action {
let position = context ? this.editorGroupService.getStacksModel().positionOfGroup(context.group) : null;
if (typeof position !== 'number') {
const activeEditor = this.editorService.getActiveEditor();
if (activeEditor && (activeEditor.position === Position.CENTER || activeEditor.position === Position.RIGHT)) {
if (activeEditor && (activeEditor.position === Position.TWO || activeEditor.position === Position.THREE)) {
position = activeEditor.position;
}
}
if (typeof position === 'number') {
const newPosition = (position === Position.CENTER) ? Position.LEFT : Position.CENTER;
const newPosition = (position === Position.TWO) ? Position.ONE : Position.TWO;
// Move group
this.editorGroupService.moveGroup(position, newPosition);
@@ -712,13 +721,13 @@ export class MoveGroupRightAction extends Action {
const activeEditor = this.editorService.getActiveEditor();
const editors = this.editorService.getVisibleEditors();
if ((editors.length === 2 && activeEditor.position === Position.LEFT) || (editors.length === 3 && activeEditor.position !== Position.RIGHT)) {
if ((editors.length === 2 && activeEditor.position === Position.ONE) || (editors.length === 3 && activeEditor.position !== Position.THREE)) {
position = activeEditor.position;
}
}
if (typeof position === 'number') {
const newPosition = (position === Position.LEFT) ? Position.CENTER : Position.RIGHT;
const newPosition = (position === Position.ONE) ? Position.TWO : Position.THREE;
// Move group
this.editorGroupService.moveGroup(position, newPosition);
@@ -754,7 +763,7 @@ export class EvenGroupWidthsAction extends Action {
}
public run(): TPromise<any> {
this.editorGroupService.arrangeGroups(GroupArrangement.EVEN_WIDTH);
this.editorGroupService.arrangeGroups(GroupArrangement.EVEN);
return TPromise.as(false);
}
@@ -938,55 +947,55 @@ export class ReopenClosedEditorAction extends Action {
}
}
export const NAVIGATE_IN_LEFT_GROUP_PREFIX = 'edt left ';
export const NAVIGATE_IN_GROUP_ONE_PREFIX = 'edt one ';
export class ShowEditorsInLeftGroupAction extends QuickOpenAction {
export class ShowEditorsInGroupOneAction extends QuickOpenAction {
public static ID = 'workbench.action.showEditorsInLeftGroup';
public static LABEL = nls.localize('showEditorsInLeftGroup', "Show Editors in Left Group");
public static ID = 'workbench.action.showEditorsInFirstGroup';
public static LABEL = nls.localize('showEditorsInFirstGroup', "Show Editors in First Group");
constructor(
actionId: string,
actionLabel: string,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(actionId, actionLabel, NAVIGATE_IN_LEFT_GROUP_PREFIX, quickOpenService);
super(actionId, actionLabel, NAVIGATE_IN_GROUP_ONE_PREFIX, quickOpenService);
this.class = 'show-group-editors-action';
}
}
export const NAVIGATE_IN_CENTER_GROUP_PREFIX = 'edt center ';
export const NAVIGATE_IN_GROUP_TWO_PREFIX = 'edt two ';
export class ShowEditorsInCenterGroupAction extends QuickOpenAction {
export class ShowEditorsInGroupTwoAction extends QuickOpenAction {
public static ID = 'workbench.action.showEditorsInCenterGroup';
public static LABEL = nls.localize('showEditorsInCenterGroup', "Show Editors in Center Group");
public static ID = 'workbench.action.showEditorsInSecondGroup';
public static LABEL = nls.localize('showEditorsInSecondGroup', "Show Editors in Second Group");
constructor(
actionId: string,
actionLabel: string,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(actionId, actionLabel, NAVIGATE_IN_CENTER_GROUP_PREFIX, quickOpenService);
super(actionId, actionLabel, NAVIGATE_IN_GROUP_TWO_PREFIX, quickOpenService);
this.class = 'show-group-editors-action';
}
}
export const NAVIGATE_IN_RIGHT_GROUP_PREFIX = 'edt right ';
export const NAVIGATE_IN_GROUP_THREE_PREFIX = 'edt three ';
export class ShowEditorsInRightGroupAction extends QuickOpenAction {
export class ShowEditorsInGroupThreeAction extends QuickOpenAction {
public static ID = 'workbench.action.showEditorsInRightGroup';
public static LABEL = nls.localize('showEditorsInRightGroup', "Show Editors in Right Group");
public static ID = 'workbench.action.showEditorsInThirdGroup';
public static LABEL = nls.localize('showEditorsInThirdGroup', "Show Editors in Third Group");
constructor(
actionId: string,
actionLabel: string,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
super(actionId, actionLabel, NAVIGATE_IN_RIGHT_GROUP_PREFIX, quickOpenService);
super(actionId, actionLabel, NAVIGATE_IN_GROUP_THREE_PREFIX, quickOpenService);
this.class = 'show-group-editors-action';
}
@@ -1014,13 +1023,13 @@ export class ShowEditorsInGroupAction extends Action {
}
switch (stacks.positionOfGroup(context.group)) {
case Position.CENTER:
return this.quickOpenService.show((groupCount === 2) ? NAVIGATE_IN_RIGHT_GROUP_PREFIX : NAVIGATE_IN_CENTER_GROUP_PREFIX);
case Position.RIGHT:
return this.quickOpenService.show(NAVIGATE_IN_RIGHT_GROUP_PREFIX);
case Position.TWO:
return this.quickOpenService.show(NAVIGATE_IN_GROUP_TWO_PREFIX);
case Position.THREE:
return this.quickOpenService.show(NAVIGATE_IN_GROUP_THREE_PREFIX);
}
return this.quickOpenService.show(NAVIGATE_IN_LEFT_GROUP_PREFIX);
return this.quickOpenService.show(NAVIGATE_IN_GROUP_ONE_PREFIX);
}
}
@@ -1054,13 +1063,12 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
const stacks = this.editorGroupService.getStacksModel();
if (stacks.activeGroup) {
const activePosition = stacks.positionOfGroup(stacks.activeGroup);
const count = stacks.groups.length;
let prefix = NAVIGATE_IN_LEFT_GROUP_PREFIX;
let prefix = NAVIGATE_IN_GROUP_ONE_PREFIX;
if (activePosition === Position.CENTER && count === 3) {
prefix = NAVIGATE_IN_CENTER_GROUP_PREFIX;
} else if (activePosition === Position.RIGHT || (activePosition === Position.CENTER && count === 2)) {
prefix = NAVIGATE_IN_RIGHT_GROUP_PREFIX;
if (activePosition === Position.TWO) {
prefix = NAVIGATE_IN_GROUP_TWO_PREFIX;
} else if (activePosition === Position.THREE) {
prefix = NAVIGATE_IN_GROUP_THREE_PREFIX;
}
this.quickOpenService.show(prefix, { quickNavigateConfiguration: { keybindings: keys } });
@@ -1222,10 +1230,10 @@ export class MoveEditorRightInGroupAction extends Action {
}
}
export class MoveEditorToLeftGroupAction extends Action {
export class MoveEditorToPreviousGroupAction extends Action {
public static ID = 'workbench.action.moveEditorToLeftGroup';
public static LABEL = nls.localize('moveEditorToLeftGroup', "Move Editor into Group to the Left");
public static ID = 'workbench.action.moveEditorToPreviousGroup';
public static LABEL = nls.localize('moveEditorToPreviousGroup', "Move Editor into Previous Group");
constructor(
id: string,
@@ -1238,7 +1246,7 @@ export class MoveEditorToLeftGroupAction extends Action {
public run(): TPromise<any> {
const activeEditor = this.editorService.getActiveEditor();
if (activeEditor && activeEditor.position !== Position.LEFT) {
if (activeEditor && activeEditor.position !== Position.ONE) {
this.editorGroupService.moveEditor(activeEditor.input, activeEditor.position, activeEditor.position - 1);
}
@@ -1246,10 +1254,10 @@ export class MoveEditorToLeftGroupAction extends Action {
}
}
export class MoveEditorToRightGroupAction extends Action {
export class MoveEditorToNextGroupAction extends Action {
public static ID = 'workbench.action.moveEditorToRightGroup';
public static LABEL = nls.localize('moveEditorToRightGroup', "Move Editor into Group to the Right");
public static ID = 'workbench.action.moveEditorToNextGroup';
public static LABEL = nls.localize('moveEditorToNextGroup', "Move Editor into Next Group");
constructor(
id: string,
@@ -1262,7 +1270,7 @@ export class MoveEditorToRightGroupAction extends Action {
public run(): TPromise<any> {
const activeEditor = this.editorService.getActiveEditor();
if (activeEditor && activeEditor.position !== Position.RIGHT) {
if (activeEditor && activeEditor.position !== Position.THREE) {
this.editorGroupService.moveEditor(activeEditor.input, activeEditor.position, activeEditor.position + 1);
}
@@ -127,13 +127,13 @@ function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, activeEditor:
newPosition = newPosition + 1;
break;
case ActiveEditorMovePositioning.FIRST:
newPosition = Position.LEFT;
newPosition = Position.ONE;
break;
case ActiveEditorMovePositioning.LAST:
newPosition = Position.RIGHT;
newPosition = Position.THREE;
break;
case ActiveEditorMovePositioning.CENTER:
newPosition = Position.CENTER;
newPosition = Position.TWO;
break;
case ActiveEditorMovePositioning.POSITION:
newPosition = args.value - 1;
@@ -211,7 +211,12 @@ function handleCommandDeprecations(): void {
'workbench.files.action.reopenClosedFile': 'workbench.action.reopenClosedEditor',
'workbench.files.action.workingFilesPicker': 'workbench.action.showAllEditors',
'workbench.action.cycleEditor': 'workbench.action.navigateEditorGroups',
'workbench.action.terminal.focus': 'workbench.action.focusPanel'
'workbench.action.terminal.focus': 'workbench.action.focusPanel',
'workbench.action.showEditorsInLeftGroup': 'workbench.action.showEditorsInFirstGroup',
'workbench.action.showEditorsInCenterGroup': 'workbench.action.showEditorsInSecondGroup',
'workbench.action.showEditorsInRightGroup': 'workbench.action.showEditorsInThirdGroup',
'workbench.action.moveEditorToLeftGroup': 'workbench.action.moveEditorToPreviousGroup',
'workbench.action.moveEditorToRightGroup': 'workbench.action.moveEditorToNextGroup'
};
Object.keys(mapDeprecatedCommands).forEach(deprecatedCommandId => {
@@ -54,7 +54,7 @@ class ProgressMonitor {
}
interface IEditorPartUIState {
widthRatio: number[];
ratio: number[];
}
interface IEditorReplacement extends EditorIdentifier {
@@ -72,9 +72,12 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
public _serviceBrand: any;
private static GROUP_LEFT_LABEL = nls.localize('leftGroup', "Left");
private static GROUP_CENTER_LABEL = nls.localize('centerGroup', "Center");
private static GROUP_RIGHT_LABEL = nls.localize('rightGroup', "Right");
private static GROUP_LEFT = nls.localize('groupOneVertical', "Left");
private static GROUP_CENTER = nls.localize('groupTwoVertical', "Center");
private static GROUP_RIGHT = nls.localize('groupThreeVertical', "Right");
private static GROUP_TOP = nls.localize('groupOneHorizontal', "Top");
private static GROUP_MIDDLE = nls.localize('groupTwoHorizontal', "Middle");
private static GROUP_BOTTOM = nls.localize('groupThreeHorizontal', "Bottom");
private static EDITOR_PART_UI_STATE_STORAGE_KEY = 'editorpart.uiState';
@@ -83,6 +86,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
private memento: any;
private stacks: EditorStacksModel;
private previewEditors: boolean;
private layoutVertically: boolean;
private _onEditorsChanged: Emitter<void>;
private _onEditorsMoved: Emitter<void>;
@@ -125,10 +129,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
this.stacks = this.instantiationService.createInstance(EditorStacksModel, restoreFromStorage);
const editorConfig = configurationService.getConfiguration<IWorkbenchEditorConfiguration>().workbench.editor;
this.previewEditors = editorConfig.enablePreview;
const config = configurationService.getConfiguration<IWorkbenchEditorConfiguration>();
if (config && config.workbench && config.workbench.editor) {
const editorConfig = config.workbench.editor;
this.telemetryService.publicLog('workbenchEditorConfiguration', editorConfig);
this.previewEditors = editorConfig.enablePreview;
this.layoutVertically = editorConfig.sideBySideLayout !== 'horizontal';
this.telemetryService.publicLog('workbenchEditorConfiguration', editorConfig);
}
this.registerListeners();
}
@@ -140,18 +149,27 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
private onConfigurationUpdated(configuration: IWorkbenchEditorConfiguration): void {
const newPreviewEditors = configuration.workbench.editor.enablePreview;
if (configuration && configuration.workbench && configuration.workbench.editor) {
const editorConfig = configuration.workbench.editor;
// Pin all preview editors of the user chose to disable preview
if (this.previewEditors !== newPreviewEditors && !newPreviewEditors) {
this.stacks.groups.forEach(group => {
if (group.previewEditor) {
this.pinEditor(group, group.previewEditor);
}
});
// Pin all preview editors of the user chose to disable preview
const newPreviewEditors = editorConfig.enablePreview;
if (this.previewEditors !== newPreviewEditors && !newPreviewEditors) {
this.stacks.groups.forEach(group => {
if (group.previewEditor) {
this.pinEditor(group, group.previewEditor);
}
});
}
this.previewEditors = newPreviewEditors;
// Rename groups when layout changes
const newLayoutVertically = editorConfig.sideBySideLayout !== 'horizontal';
if (newLayoutVertically !== this.layoutVertically) {
this.layoutVertically = newLayoutVertically;
this.renameGroups();
}
}
this.previewEditors = newPreviewEditors;
}
private onEditorDirty(identifier: EditorIdentifier): void {
@@ -178,14 +196,14 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
public openEditor(input: EditorInput, options?: EditorOptions, sideBySide?: boolean): TPromise<BaseEditor>;
public openEditor(input: EditorInput, options?: EditorOptions, position?: Position, widthRatios?: number[]): TPromise<BaseEditor>;
public openEditor(input: EditorInput, options?: EditorOptions, arg3?: any, widthRatios?: number[]): TPromise<BaseEditor> {
public openEditor(input: EditorInput, options?: EditorOptions, position?: Position, ratio?: number[]): TPromise<BaseEditor>;
public openEditor(input: EditorInput, options?: EditorOptions, arg3?: any, ratio?: number[]): TPromise<BaseEditor> {
// Normalize some values
if (!options) { options = null; }
// Determine position to open editor in (left, center, right)
const position = this.findPosition(input, options, arg3, widthRatios);
// Determine position to open editor in (one, two, three)
const position = this.findPosition(input, options, arg3, ratio);
// Some conditions under which we prevent the request
if (
@@ -204,15 +222,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Opened to the side
if (position !== Position.LEFT) {
if (position !== Position.ONE) {
this.telemetryService.publicLog('workbenchSideEditorOpened', { position: position });
}
// Open through UI
return this.doOpenEditor(position, descriptor, input, options, widthRatios);
return this.doOpenEditor(position, descriptor, input, options, ratio);
}
private doOpenEditor(position: Position, descriptor: IEditorDescriptor, input: EditorInput, options: EditorOptions, widthRatios: number[]): TPromise<BaseEditor> {
private doOpenEditor(position: Position, descriptor: IEditorDescriptor, input: EditorInput, options: EditorOptions, ratio: number[]): TPromise<BaseEditor> {
// Update stacks: We do this early on before the UI is there because we want our stacks model to have
// a consistent view of the editor world and updating it later async after the UI is there will cause
@@ -243,7 +261,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}));
// Show editor
return this.doShowEditor(group, descriptor, input, options, widthRatios, monitor).then(editor => {
return this.doShowEditor(group, descriptor, input, options, ratio, monitor).then(editor => {
if (!editor) {
return TPromise.as<BaseEditor>(null); // canceled or other error
}
@@ -253,7 +271,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
});
}
private doShowEditor(group: EditorGroup, descriptor: IEditorDescriptor, input: EditorInput, options: EditorOptions, widthRatios: number[], monitor: ProgressMonitor): TPromise<BaseEditor> {
private doShowEditor(group: EditorGroup, descriptor: IEditorDescriptor, input: EditorInput, options: EditorOptions, ratio: number[], monitor: ProgressMonitor): TPromise<BaseEditor> {
const position = this.stacks.positionOfGroup(group);
const editorAtPosition = this.visibleEditors[position];
@@ -281,7 +299,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Show in side by side control
this.sideBySideControl.show(editor, position, options && options.preserveFocus, widthRatios);
this.sideBySideControl.show(editor, position, options && options.preserveFocus, ratio);
// Indicate to editor that it is now visible
editor.setVisible(true, position);
@@ -518,7 +536,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Explicitly trigger the focus changed handler because the side by side control will not trigger it unless
// the user is actively changing focus with the mouse from left to right.
// the user is actively changing focus with the mouse from left/top to right/bottom.
this.onGroupFocusChanged();
}
}
@@ -886,9 +904,9 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
activePosition = this.stacks.positionOfGroup(this.stacks.activeGroup);
}
const widthRatios = this.sideBySideControl.getWidthRatios();
const ratio = this.sideBySideControl.getRatio();
return this.doOpenEditors(editors, activePosition, widthRatios);
return this.doOpenEditors(editors, activePosition, ratio);
}
public restoreEditors(): TPromise<BaseEditor[]> {
@@ -911,43 +929,43 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const editorState: IEditorPartUIState = this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY];
return this.doOpenEditors(editors, activePosition, editorState && editorState.widthRatio);
return this.doOpenEditors(editors, activePosition, editorState && editorState.ratio);
}
private doOpenEditors(editors: { input: EditorInput, position: Position, options?: EditorOptions }[], activePosition?: number, widthRatios?: number[]): TPromise<BaseEditor[]> {
const leftEditors = editors.filter(e => e.position === Position.LEFT);
const centerEditors = editors.filter(e => e.position === Position.CENTER);
const rightEditors = editors.filter(e => e.position === Position.RIGHT);
private doOpenEditors(editors: { input: EditorInput, position: Position, options?: EditorOptions }[], activePosition?: number, ratio?: number[]): TPromise<BaseEditor[]> {
const positionOneEditors = editors.filter(e => e.position === Position.ONE);
const positionTwoEditors = editors.filter(e => e.position === Position.TWO);
const positionThreeEditors = editors.filter(e => e.position === Position.THREE);
const leftGroup = this.stacks.groupAt(Position.LEFT);
const centerGroup = this.stacks.groupAt(Position.CENTER);
const rightGroup = this.stacks.groupAt(Position.RIGHT);
const groupOne = this.stacks.groupAt(Position.ONE);
const groupTwo = this.stacks.groupAt(Position.TWO);
const groupThree = this.stacks.groupAt(Position.THREE);
// Compute the imaginary count if we const all editors open as the way requested
const leftCount = leftEditors.length + (leftGroup ? leftGroup.count : 0);
const centerCount = centerEditors.length + (centerGroup ? centerGroup.count : 0);
const rightCount = rightEditors.length + (rightGroup ? rightGroup.count : 0);
const oneCount = positionOneEditors.length + (groupOne ? groupOne.count : 0);
const twoCount = positionTwoEditors.length + (groupTwo ? groupTwo.count : 0);
const threeCount = positionThreeEditors.length + (groupThree ? groupThree.count : 0);
// Validate we do not produce empty groups given our imaginary count model
if ((!leftCount && (centerCount || rightCount) || (!centerCount && rightCount))) {
leftEditors.push(...centerEditors);
leftEditors.push(...rightEditors);
centerEditors.splice(0, centerEditors.length);
rightEditors.splice(0, rightEditors.length);
if ((!oneCount && (twoCount || threeCount) || (!twoCount && threeCount))) {
positionOneEditors.push(...positionTwoEditors);
positionOneEditors.push(...positionThreeEditors);
positionTwoEditors.splice(0, positionTwoEditors.length);
positionThreeEditors.splice(0, positionThreeEditors.length);
}
// Validate active input
if (typeof activePosition !== 'number') {
activePosition = Position.LEFT;
activePosition = Position.ONE;
}
// Validate width ratios
const positions = rightEditors.length ? 3 : centerEditors.length ? 2 : 1;
if (!widthRatios || widthRatios.length !== positions) {
// Validate ratios
const positions = positionThreeEditors.length ? 3 : positionTwoEditors.length ? 2 : 1;
if (!ratio || ratio.length !== positions) {
if (!this.getVisibleEditors().length) {
widthRatios = (positions === 3) ? [0.33, 0.33, 0.34] : (positions === 2) ? [0.5, 0.5] : [1];
ratio = (positions === 3) ? [0.33, 0.33, 0.34] : (positions === 2) ? [0.5, 0.5] : [1];
} else {
widthRatios = void 0;
ratio = void 0;
}
}
@@ -962,7 +980,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// Open each input respecting the options. Since there can only be one active editor in each
// position, we have to pick the first input from each position and add the others as inactive
const promises: TPromise<BaseEditor>[] = [];
[leftEditors.shift(), centerEditors.shift(), rightEditors.shift()].forEach((editor, position) => {
[positionOneEditors.shift(), positionTwoEditors.shift(), positionThreeEditors.shift()].forEach((editor, position) => {
if (!editor) {
return; // unused position
}
@@ -981,7 +999,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
options = EditorOptions.create({ preserveFocus });
}
promises.push(this.openEditor(input, options, position, widthRatios));
promises.push(this.openEditor(input, options, position, ratio));
});
return TPromise.join(promises).then(editors => {
@@ -992,7 +1010,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
// Update stacks model for remaining inactive editors
[leftEditors, centerEditors, rightEditors].forEach((editors, index) => {
[positionOneEditors, positionTwoEditors, positionThreeEditors].forEach((editors, index) => {
const group = this.stacks.groupAt(index);
if (group) {
editors.forEach(editor => group.openEditor(editor.input, { pinned: true })); // group could be null if one openeditor call failed!
@@ -1106,7 +1124,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
public shutdown(): void {
// Persist UI State
const editorState: IEditorPartUIState = { widthRatio: this.sideBySideControl.getWidthRatios() };
const editorState: IEditorPartUIState = { ratio: this.sideBySideControl.getRatio() };
this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY] = editorState;
// Unload all Instantiated Editors
@@ -1160,12 +1178,12 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
super.dispose();
}
private findPosition(input: EditorInput, options?: EditorOptions, sideBySide?: boolean, widthRatios?: number[]): Position;
private findPosition(input: EditorInput, options?: EditorOptions, desiredPosition?: Position, widthRatios?: number[]): Position;
private findPosition(input: EditorInput, options?: EditorOptions, arg1?: any, widthRatios?: number[]): Position {
private findPosition(input: EditorInput, options?: EditorOptions, sideBySide?: boolean, ratio?: number[]): Position;
private findPosition(input: EditorInput, options?: EditorOptions, desiredPosition?: Position, ratio?: number[]): Position;
private findPosition(input: EditorInput, options?: EditorOptions, arg1?: any, ratio?: number[]): Position {
// With defined width ratios, always trust the provided position
if (widthRatios && types.isNumber(arg1)) {
// With defined ratios, always trust the provided position
if (ratio && types.isNumber(arg1)) {
return arg1;
}
@@ -1173,7 +1191,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const visibleEditors = this.getVisibleEditors();
const activeEditor = this.getActiveEditor();
if (visibleEditors.length === 0 || !activeEditor) {
return Position.LEFT; // can only be LEFT
return Position.ONE; // can only be ONE
}
// Respect option to reveal an editor if it is already visible
@@ -1189,30 +1207,30 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
}
}
// Position is unknown: pick last active or LEFT
// Position is unknown: pick last active or ONE
if (types.isUndefinedOrNull(arg1) || arg1 === false) {
const lastActivePosition = this.sideBySideControl.getActivePosition();
return lastActivePosition || Position.LEFT;
return lastActivePosition || Position.ONE;
}
// Position is sideBySide: Find position relative to active editor
if (arg1 === true) {
switch (activeEditor.position) {
case Position.LEFT:
return Position.CENTER;
case Position.CENTER:
return Position.RIGHT;
case Position.RIGHT:
return null; // Cannot open to the side of the right most editor
case Position.ONE:
return Position.TWO;
case Position.TWO:
return Position.THREE;
case Position.THREE:
return null; // Cannot open to the side of the right/bottom most editor
}
return null; // Prevent opening to the side
}
// Position is provided, validate it
if (arg1 === Position.RIGHT && visibleEditors.length === 1) {
return Position.CENTER;
if (arg1 === Position.THREE && visibleEditors.length === 1) {
return Position.TWO;
}
return arg1;
@@ -1244,7 +1262,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
// Close visible ones second
visibleEditors
.sort((a1, a2) => this.stacks.positionOfGroup(a2.group) - this.stacks.positionOfGroup(a1.group)) // reduce layout work by starting right first
.sort((a1, a2) => this.stacks.positionOfGroup(a2.group) - this.stacks.positionOfGroup(a1.group)) // reduce layout work by starting right/bottom first
.forEach(visible => this.doCloseEditor(<EditorGroup>visible.group, visible.editor, false));
// Reset
@@ -1260,15 +1278,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
if (types.isUndefinedOrNull(arg2)) {
const rochade = <Rochade>arg1;
switch (rochade) {
case Rochade.CENTER_TO_LEFT:
this.rochade(Position.CENTER, Position.LEFT);
case Rochade.TWO_TO_ONE:
this.rochade(Position.TWO, Position.ONE);
break;
case Rochade.RIGHT_TO_CENTER:
this.rochade(Position.RIGHT, Position.CENTER);
case Rochade.THREE_TO_TWO:
this.rochade(Position.THREE, Position.TWO);
break;
case Rochade.CENTER_AND_RIGHT_TO_LEFT:
this.rochade(Position.CENTER, Position.LEFT);
this.rochade(Position.RIGHT, Position.CENTER);
case Rochade.TWO_AND_THREE_TO_ONE:
this.rochade(Position.TWO, Position.ONE);
this.rochade(Position.THREE, Position.TWO);
}
} else {
const from = <Position>arg1;
@@ -1327,22 +1345,22 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const groups = this.stacks.groups;
if (groups.length > 0) {
// LEFT | CENTER | RIGHT
// ONE | TWO | THREE
if (groups.length > 2) {
this.stacks.renameGroup(this.stacks.groupAt(Position.LEFT), EditorPart.GROUP_LEFT_LABEL);
this.stacks.renameGroup(this.stacks.groupAt(Position.CENTER), EditorPart.GROUP_CENTER_LABEL);
this.stacks.renameGroup(this.stacks.groupAt(Position.RIGHT), EditorPart.GROUP_RIGHT_LABEL);
this.stacks.renameGroup(this.stacks.groupAt(Position.ONE), this.layoutVertically ? EditorPart.GROUP_LEFT : EditorPart.GROUP_TOP);
this.stacks.renameGroup(this.stacks.groupAt(Position.TWO), this.layoutVertically ? EditorPart.GROUP_CENTER : EditorPart.GROUP_MIDDLE);
this.stacks.renameGroup(this.stacks.groupAt(Position.THREE), this.layoutVertically ? EditorPart.GROUP_RIGHT : EditorPart.GROUP_BOTTOM);
}
// LEFT | RIGHT
// ONE | TWO
else if (groups.length > 1) {
this.stacks.renameGroup(this.stacks.groupAt(Position.LEFT), EditorPart.GROUP_LEFT_LABEL);
this.stacks.renameGroup(this.stacks.groupAt(Position.CENTER), EditorPart.GROUP_RIGHT_LABEL);
this.stacks.renameGroup(this.stacks.groupAt(Position.ONE), this.layoutVertically ? EditorPart.GROUP_LEFT : EditorPart.GROUP_TOP);
this.stacks.renameGroup(this.stacks.groupAt(Position.TWO), this.layoutVertically ? EditorPart.GROUP_RIGHT : EditorPart.GROUP_BOTTOM);
}
// LEFT
// ONE
else {
this.stacks.renameGroup(this.stacks.groupAt(Position.LEFT), EditorPart.GROUP_LEFT_LABEL);
this.stacks.renameGroup(this.stacks.groupAt(Position.ONE), this.layoutVertically ? EditorPart.GROUP_LEFT : EditorPart.GROUP_TOP);
}
}
}
@@ -184,7 +184,7 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
return nls.localize('noResultsFoundInGroup', "No matching opened editor found in group");
}
return nls.localize('noOpenedEditors', "List of opened editors is currently empty");
return nls.localize('noOpenedEditors', "List of opened editors is currently empty in group");
}
public getAutoFocus(searchValue: string, quickNavigateConfiguration: IQuickNavigateConfiguration): IAutoFocus {
@@ -214,28 +214,24 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
}
}
export class LeftEditorGroupPicker extends EditorGroupPicker {
export class GroupOnePicker extends EditorGroupPicker {
protected getPosition(): Position {
return Position.LEFT;
return Position.ONE;
}
}
export class CenterEditorGroupPicker extends EditorGroupPicker {
export class GroupTwoPicker extends EditorGroupPicker {
protected getPosition(): Position {
const stacks = this.editorGroupService.getStacksModel();
return stacks.groups.length > 2 ? Position.CENTER : -1; // with 2 groups open, the center one is not available
return Position.TWO;
}
}
export class RightEditorGroupPicker extends EditorGroupPicker {
export class GroupThreePicker extends EditorGroupPicker {
protected getPosition(): Position {
const stacks = this.editorGroupService.getStacksModel();
return stacks.groups.length > 2 ? Position.RIGHT : Position.CENTER;
return Position.THREE;
}
}
@@ -259,7 +255,7 @@ export class AllEditorsPicker extends BaseEditorPicker {
return nls.localize('noResultsFound', "No matching opened editor found");
}
return nls.localize('noOpenedEditors', "List of opened editors is currently empty");
return nls.localize('noOpenedEditorsAllGroups', "List of opened editors is currently empty");
}
public getAutoFocus(searchValue: string): IAutoFocus {
@@ -40,12 +40,12 @@
outline-offset: -2px;
}
.vs .monaco-workbench > .editor > .content.dragging {
.vs .monaco-workbench > .editor > .content.vertical-layout.dragging {
border-left: 1px solid #E7E7E7;
border-right: 1px solid #E7E7E7;
}
.vs-dark .monaco-workbench > .editor > .content.dragging {
.vs-dark .monaco-workbench > .editor > .content.vertical-layout.dragging {
border-left: 1px solid #444;
border-right: 1px solid #444;
}
@@ -55,57 +55,100 @@
box-sizing: border-box; /* use border box to be able to draw a border as separator between editors */
}
.monaco-workbench > .editor > .content > .one-editor-silo.editor-left {
.monaco-workbench > .editor > .content > .one-editor-silo.editor-one {
left: 0;
top: 0;
}
.monaco-workbench > .editor > .content > .one-editor-silo.editor-right {
.monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-three {
right: 0;
}
.monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-three {
bottom: 0;
}
.monaco-workbench > .editor > .content > .one-editor-silo.dragging {
z-index: 2000000;
box-sizing: content-box;
}
.vs .monaco-workbench > .editor > .content > .one-editor-silo.dragging {
.vs .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.dragging {
border-left: 1px solid #E7E7E7;
border-right: 1px solid #E7E7E7;
}
.vs .monaco-workbench > .editor > .content > .one-editor-silo.editor-center,
.vs .monaco-workbench > .editor > .content > .one-editor-silo.editor-right {
.vs .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.dragging {
border-top: 1px solid #E7E7E7;
border-bottom: 1px solid #E7E7E7;
}
.vs .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-two,
.vs .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-three {
border-left: 1px solid #E7E7E7;
}
.vs-dark .monaco-workbench > .editor > .content > .one-editor-silo.dragging {
.vs .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-two,
.vs .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-three {
border-top: 1px solid #E7E7E7;
}
.vs-dark .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.dragging {
border-left: 1px solid #444;
border-right: 1px solid #444;
}
.vs-dark .monaco-workbench > .editor > .content > .one-editor-silo.editor-center,
.vs-dark .monaco-workbench > .editor > .content > .one-editor-silo.editor-right {
.vs-dark .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.dragging {
border-top: 1px solid #444;
border-bottom: 1px solid #444;
}
.vs-dark .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-two,
.vs-dark .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-three {
border-left: 1px solid #444;
}
.hc-black .monaco-workbench > .editor > .content > .one-editor-silo.dragging {
.vs-dark .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-two,
.vs-dark .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-three {
border-top: 1px solid #444;
}
.hc-black .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.dragging {
border-left: 1px solid #6FC3DF;
border-right: 1px solid #6FC3DF;
}
.hc-black .monaco-workbench > .editor > .content > .one-editor-silo.editor-center,
.hc-black .monaco-workbench > .editor > .content > .one-editor-silo.editor-right {
.hc-black .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.dragging {
border-top: 1px solid #6FC3DF;
border-bottom: 1px solid #6FC3DF;
}
.hc-black .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-two,
.hc-black .monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.editor-three {
border-left: 1px solid #6FC3DF;
}
.monaco-workbench > .editor > .content > .one-editor-silo.draggedunder {
.hc-black .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-two,
.hc-black .monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.editor-three {
border-top: 1px solid #6FC3DF;
}
.monaco-workbench > .editor > .content.vertical-layout > .one-editor-silo.draggedunder {
transition: left 200ms ease-out;
}
.monaco-workbench > .editor > .content > .editor-right.draggedunder {
.monaco-workbench > .editor > .content.vertical-layout > .editor-three.draggedunder {
transition-property: right;
}
.monaco-workbench > .editor > .content.horizontal-layout > .one-editor-silo.draggedunder {
transition: top 200ms ease-out;
}
.monaco-workbench > .editor > .content.horizontal-layout > .editor-three.draggedunder {
transition-property: bottom;
}
.monaco-workbench > .editor > .content > .one-editor-silo > .container {
height: 100%;
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}.icon-vs-fg{fill:#2b282e}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 15H0V0h16v15z" id="outline" style="display: none;"/><path class="icon-vs-fg" d="M14 13H2v-2h12v2zM2 6h12V4H2v2zm0 7h12v-2H2v2zm0-9v2h12V4H2z" id="iconFg" style="display: none;"/><path class="icon-vs-bg" d="M1 1v6h14V1H1zm13 5H2V4h12v2zM1 14h14V8H1v6zm1-3h12v2H2v-2z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 648 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}.icon-vs-fg{fill:#f0eff1}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 15H0V0h16v15z" id="outline" style="display: none;"/><path class="icon-vs-fg" d="M14 13H2v-2h12v2zM2 6h12V4H2v2zm0 7h12v-2H2v2zm0-9v2h12V4H2z" id="iconFg" style="display: none;"/><path class="icon-vs-bg" d="M1 1v6h14V1H1zm13 5H2V4h12v2zM1 14h14V8H1v6zm1-3h12v2H2v-2z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 648 B

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

@@ -97,13 +97,22 @@
background: url('close-inverse.svg') center center no-repeat;
}
.monaco-workbench .split-editor-action {
background: url('split-editor.svg') center center no-repeat;
.monaco-workbench > .part.editor > .content.vertical-layout > .one-editor-silo > .container > .title .split-editor-action {
background: url('split-editor-vertical.svg') center center no-repeat;
}
.vs-dark .monaco-workbench .split-editor-action,
.hc-black .monaco-workbench .split-editor-action {
background: url('split-editor-inverse.svg') center center no-repeat;
.vs-dark .monaco-workbench > .part.editor > .content.vertical-layout > .one-editor-silo > .container > .title .split-editor-action,
.hc-black .monaco-workbench > .part.editor > .content.vertical-layout > .one-editor-silo > .container > .title .split-editor-action {
background: url('split-editor-vertical-inverse.svg') center center no-repeat;
}
.monaco-workbench > .part.editor > .content.horizontal-layout > .one-editor-silo > .container > .title .split-editor-action {
background: url('split-editor-horizontal.svg') center center no-repeat;
}
.vs-dark .monaco-workbench > .part.editor > .content.horizontal-layout > .one-editor-silo > .container > .title .split-editor-action,
.hc-black .monaco-workbench > .part.editor > .content.horizontal-layout > .one-editor-silo > .container > .title .split-editor-action {
background: url('split-editor-horizontal-inverse.svg') center center no-repeat;
}
.monaco-workbench .show-group-editors-action {
File diff suppressed because it is too large Load Diff
+1
View File
@@ -858,6 +858,7 @@ export interface IWorkbenchEditorConfiguration {
enablePreview: boolean;
enablePreviewFromQuickOpen: boolean;
openPositioning: 'left' | 'right' | 'first' | 'last';
sideBySideLayout: 'vertical' | 'horizontal';
}
};
}
@@ -257,7 +257,7 @@ export class ElectronIntegration {
return this.editorService.openEditors(resources.map((r, index) => {
return {
input: r,
position: activeEditor ? activeEditor.position : Position.LEFT
position: activeEditor ? activeEditor.position : Position.ONE
};
}));
});
@@ -74,6 +74,12 @@ configurationRegistry.registerConfiguration({
'title': nls.localize('workbenchConfigurationTitle', "Workbench"),
'type': 'object',
'properties': {
'workbench.editor.sideBySideLayout': {
'type': 'string',
'enum': ['vertical', 'horizontal'],
'default': 'vertical',
'description': nls.localize('sideBySideLayout', "Controls if side by side editors should layout horizontally or vertically.")
},
'workbench.editor.showTabs': {
'type': 'boolean',
'description': nls.localize('showEditorTabs', "Controls if opened editors should show in tabs or not."),
@@ -20,6 +20,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
import { Registry } from 'vs/platform/platform';
import { isWindows, isLinux } from 'vs/base/common/platform';
import { IOptions } from 'vs/workbench/common/options';
import { Position as EditorPosition } from 'vs/platform/editor/common/editor';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IEditorRegistry, Extensions as EditorExtensions, TextEditorOptions, EditorInput, EditorOptions } from 'vs/workbench/common/editor';
@@ -248,7 +249,7 @@ export class Workbench implements IPartService {
return {
input: inputWithOptions.input,
options: inputWithOptions.options,
position: Position.LEFT
position: EditorPosition.ONE
};
});
@@ -217,7 +217,7 @@ class OpenExtensionToSideAction extends Action {
private updateEnablement(): void {
const activeEditor = this.editorService.getActiveEditor();
this.enabled = (!activeEditor || activeEditor.position !== Position.RIGHT);
this.enabled = (!activeEditor || activeEditor.position !== Position.THREE);
}
run(context: { extension: IExtension }): TPromise<any> {
@@ -1175,7 +1175,7 @@ export class OpenToSideAction extends Action {
private updateEnablement(): void {
const activeEditor = this.editorService.getActiveEditor();
this.enabled = (!activeEditor || activeEditor.position !== Position.RIGHT);
this.enabled = (!activeEditor || activeEditor.position !== Position.THREE);
}
public run(): TPromise<any> {
@@ -57,13 +57,22 @@
background: url('CollapseAll_inverse.svg') center center no-repeat;
}
.monaco-workbench .quick-open-sidebyside {
background-image: url('SplitEditor.svg');
.monaco-workbench .quick-open-sidebyside-vertical {
background-image: url('split-editor-vertical.svg');
}
.vs-dark .monaco-workbench .quick-open-sidebyside,
.hc-black .monaco-workbench .quick-open-sidebyside {
background-image: url('SplitEditor_inverse.svg');
.vs-dark .monaco-workbench .quick-open-sidebyside-vertical,
.hc-black .monaco-workbench .quick-open-sidebyside-vertical {
background-image: url('split-editor-vertical-inverse.svg');
}
.monaco-workbench .quick-open-sidebyside-horizontal {
background-image: url('split-editor-horizontal.svg');
}
.vs-dark .monaco-workbench .quick-open-sidebyside-horizontal,
.hc-black .monaco-workbench .quick-open-sidebyside-horizontal {
background-image: url('split-editor-horizontal-inverse.svg');
}
.monaco-workbench .conflict-editor-action.accept-changes {
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}.icon-vs-fg{fill:#2b282e}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 15H0V0h16v15z" id="outline" style="display: none;"/><path class="icon-vs-fg" d="M14 13H2v-2h12v2zM2 6h12V4H2v2zm0 7h12v-2H2v2zm0-9v2h12V4H2z" id="iconFg" style="display: none;"/><path class="icon-vs-bg" d="M1 1v6h14V1H1zm13 5H2V4h12v2zM1 14h14V8H1v6zm1-3h12v2H2v-2z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 648 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}.icon-vs-fg{fill:#f0eff1}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 15H0V0h16v15z" id="outline" style="display: none;"/><path class="icon-vs-fg" d="M14 13H2v-2h12v2zM2 6h12V4H2v2zm0 7h12v-2H2v2zm0-9v2h12V4H2z" id="iconFg" style="display: none;"/><path class="icon-vs-bg" d="M1 1v6h14V1H1zm13 5H2V4h12v2zM1 14h14V8H1v6zm1-3h12v2H2v-2z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 648 B

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -1 16 16" enable-background="new 0 -1 16 16"><path fill="#424242" d="M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -1 16 16" enable-background="new 0 -1 16 16"><path fill="#656565" d="M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"/></svg>

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

@@ -25,6 +25,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletSer
import { Renderer, DataSource, Controller, AccessibilityProvider, ActionProvider, OpenEditor, DragAndDrop } from 'vs/workbench/parts/files/browser/views/openEditorsViewer';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { CloseAllEditorsAction } from 'vs/workbench/browser/parts/editor/editorActions';
import { ToggleEditorLayoutAction } from 'vs/workbench/browser/actions/toggleEditorLayout';
const $ = dom.$;
@@ -77,6 +78,7 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView {
public getActions(): IAction[] {
return [
this.instantiationService.createInstance(ToggleEditorLayoutAction, ToggleEditorLayoutAction.ID, ToggleEditorLayoutAction.LABEL),
this.instantiationService.createInstance(SaveAllAction, SaveAllAction.ID, SaveAllAction.LABEL),
this.instantiationService.createInstance(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL)
];
@@ -104,7 +104,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
this.pendingDirtyResources = [];
const activeEditor = this.editorService.getActiveEditor();
const activePosition = activeEditor ? activeEditor.position : Position.LEFT;
const activePosition = activeEditor ? activeEditor.position : Position.ONE;
// Open
this.editorService.openEditors(dirtyNotOpenedResources.map(resource => {
@@ -12,7 +12,7 @@ import Event from 'vs/base/common/event';
export enum GroupArrangement {
MINIMIZE_OTHERS,
EVEN_WIDTH
EVEN
}
export const IEditorGroupService = createDecorator<IEditorGroupService>('editorGroupService');
@@ -290,7 +290,7 @@ suite('Workbench UI Services', () => {
assert(service.getVisibleEditors()[0] === editor);
});
service.openEditor(activeInput, null, Position.LEFT).then((editor) => {
service.openEditor(activeInput, null, Position.ONE).then((editor) => {
assert.strictEqual(openedEditorInput, activeInput);
assert.strictEqual(openedEditorOptions, null);
assert.strictEqual(editor, activeEditor);
@@ -296,9 +296,9 @@ suite('Editor Stacks Model', () => {
const group2 = model.openGroup('second');
const group3 = model.openGroup('third');
assert.equal(Position.LEFT, model.positionOfGroup(group1));
assert.equal(Position.CENTER, model.positionOfGroup(group2));
assert.equal(Position.RIGHT, model.positionOfGroup(group3));
assert.equal(Position.ONE, model.positionOfGroup(group1));
assert.equal(Position.TWO, model.positionOfGroup(group2));
assert.equal(Position.THREE, model.positionOfGroup(group3));
});
test('Groups - Rename Group', function () {
+1
View File
@@ -23,6 +23,7 @@ import 'vs/platform/actions/browser/menusExtensionPoint';
import 'vs/workbench/browser/actions/toggleStatusbarVisibility';
import 'vs/workbench/browser/actions/toggleSidebarVisibility';
import 'vs/workbench/browser/actions/toggleSidebarPosition';
import 'vs/workbench/browser/actions/toggleEditorLayout';
import 'vs/workbench/browser/actions/openSettings';
import 'vs/workbench/browser/actions/configureLocale';