提交 49ad9b90 编写于 作者: B Benjamin Pasero

better editor layout management (fixes #14105)

上级 012622ea
...@@ -31,9 +31,6 @@ interface IConfiguration extends IFilesConfiguration { ...@@ -31,9 +31,6 @@ interface IConfiguration extends IFilesConfiguration {
}, },
statusBar: { statusBar: {
visible: boolean; visible: boolean;
},
editor: {
sideBySideLayout: 'vertical' | 'horizontal'
} }
}; };
} }
...@@ -46,7 +43,6 @@ export class VSCodeMenu { ...@@ -46,7 +43,6 @@ export class VSCodeMenu {
private currentAutoSaveSetting: string; private currentAutoSaveSetting: string;
private currentSidebarLocation: 'left' | 'right'; private currentSidebarLocation: 'left' | 'right';
private currentEditorLayout: 'vertical' | 'horizontal';
private currentStatusbarVisible: boolean; private currentStatusbarVisible: boolean;
private isQuitting: boolean; private isQuitting: boolean;
...@@ -155,12 +151,6 @@ export class VSCodeMenu { ...@@ -155,12 +151,6 @@ export class VSCodeMenu {
this.currentStatusbarVisible = newStatusbarVisible; this.currentStatusbarVisible = newStatusbarVisible;
updateMenu = true; updateMenu = true;
} }
const newEditorLayout = config.workbench.editor && config.workbench.editor.sideBySideLayout || 'vertical';
if (newEditorLayout !== this.currentEditorLayout) {
this.currentEditorLayout = newEditorLayout;
updateMenu = true;
}
} }
if (handleMenu && updateMenu) { if (handleMenu && updateMenu) {
...@@ -531,15 +521,7 @@ export class VSCodeMenu { ...@@ -531,15 +521,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 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 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 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 Group &&Layout"), 'workbench.action.toggleEditorGroupLayout');
let editorLayoutLabel: string;
if (this.currentEditorLayout !== 'horizontal') {
editorLayoutLabel = nls.localize({ key: 'miHorizontalEditorLayout', comment: ['&& denotes a mnemonic'] }, "Horizontal Editor &&Layout");
} else {
editorLayoutLabel = nls.localize({ key: 'miVerticalEditorLayout', comment: ['&& denotes a mnemonic'] }, "Vertical Editor &&Layout");
}
const toggleEditorLayout = this.createMenuItem(editorLayoutLabel, 'workbench.action.toggleEditorLayout');
const toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility'); const toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility');
let moveSideBarLabel: string; let moveSideBarLabel: string;
......
...@@ -30,7 +30,7 @@ import { ILifecycleService, ShutdownEvent } from 'vs/platform/lifecycle/common/l ...@@ -30,7 +30,7 @@ import { ILifecycleService, ShutdownEvent } from 'vs/platform/lifecycle/common/l
import { EditorStacksModel } from 'vs/workbench/common/editor/editorStacksModel'; import { EditorStacksModel } from 'vs/workbench/common/editor/editorStacksModel';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { IEditorGroupService, GroupArrangement } from 'vs/workbench/services/group/common/groupService'; import { IEditorGroupService, GroupArrangement, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { TextFileService } from 'vs/workbench/services/textfile/browser/textFileService'; import { TextFileService } from 'vs/workbench/services/textfile/browser/textFileService';
import { IFileService, IResolveContentOptions, IFileOperationResult } from 'vs/platform/files/common/files'; import { IFileService, IResolveContentOptions, IFileOperationResult } from 'vs/platform/files/common/files';
import { IModelService } from 'vs/editor/common/services/modelService'; import { IModelService } from 'vs/editor/common/services/modelService';
...@@ -372,6 +372,14 @@ export class TestEditorGroupService implements IEditorGroupService { ...@@ -372,6 +372,14 @@ export class TestEditorGroupService implements IEditorGroupService {
} }
public setGroupOrientation(orientation: GroupOrientation): void {
}
public getGroupOrientation(): GroupOrientation {
return 'vertical';
}
public pinEditor(group: IEditorGroup, input: IEditorInput): void; public pinEditor(group: IEditorGroup, input: IEditorInput): void;
public pinEditor(position: Position, input: IEditorInput): void; public pinEditor(position: Position, input: IEditorInput): void;
public pinEditor(arg1: any, input: IEditorInput): void { public pinEditor(arg1: any, input: IEditorInput): void {
......
...@@ -10,30 +10,22 @@ import nls = require('vs/nls'); ...@@ -10,30 +10,22 @@ import nls = require('vs/nls');
import { Registry } from 'vs/platform/platform'; import { Registry } from 'vs/platform/platform';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/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 { 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';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { IEditorGroupService, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { dispose, IDisposable } from 'vs/base/common/lifecycle'; import { dispose, IDisposable } from 'vs/base/common/lifecycle';
export class ToggleEditorLayoutAction extends Action { export class ToggleEditorLayoutAction extends Action {
public static ID = 'workbench.action.toggleEditorLayout'; public static ID = 'workbench.action.toggleEditorGroupLayout';
public static LABEL = nls.localize('toggleEditorLayout', "Toggle Vertical/Horizontal Layout"); public static LABEL = nls.localize('toggleEditorGroupLayout', "Toggle Editor Group Layout");
private static editorLayoutConfigurationKey = 'workbench.editor.sideBySideLayout';
private toDispose: IDisposable[]; private toDispose: IDisposable[];
constructor( constructor(
id: string, id: string,
label: string, label: string,
@IMessageService private messageService: IMessageService, @IEditorGroupService private editorGroupService: IEditorGroupService
@IConfigurationService private configurationService: IConfigurationService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IConfigurationEditingService private configurationEditingService: IConfigurationEditingService
) { ) {
super(id, label); super(id, label);
...@@ -47,12 +39,6 @@ export class ToggleEditorLayoutAction extends Action { ...@@ -47,12 +39,6 @@ export class ToggleEditorLayoutAction extends Action {
private registerListeners(): void { private registerListeners(): void {
this.toDispose.push(this.editorGroupService.onEditorsChanged(() => this.updateEnablement())); this.toDispose.push(this.editorGroupService.onEditorsChanged(() => this.updateEnablement()));
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(() => this.updateLabel()));
}
private updateLabel(): void {
const editorLayoutVertical = this.configurationService.lookup('workbench.editor.sideBySideLayout').value !== 'horizontal';
this.label = editorLayoutVertical ? nls.localize('horizontalLayout', "Horizontal Editor Layout") : nls.localize('verticalLayout', "Vertical Editor Layout");
} }
private updateEnablement(): void { private updateEnablement(): void {
...@@ -60,12 +46,10 @@ export class ToggleEditorLayoutAction extends Action { ...@@ -60,12 +46,10 @@ export class ToggleEditorLayoutAction extends Action {
} }
public run(): TPromise<any> { public run(): TPromise<any> {
const editorLayoutVertical = this.configurationService.lookup('workbench.editor.sideBySideLayout').value !== 'horizontal'; const groupOrientiation = this.editorGroupService.getGroupOrientation();
const newEditorLayout = editorLayoutVertical ? 'horizontal' : 'vertical'; const newGroupOrientation: GroupOrientation = (groupOrientiation === 'vertical') ? 'horizontal' : 'vertical';
this.configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: ToggleEditorLayoutAction.editorLayoutConfigurationKey, value: newEditorLayout }).then(null, error => { this.editorGroupService.setGroupOrientation(newGroupOrientation);
this.messageService.show(Severity.Error, error);
});
return TPromise.as(null); return TPromise.as(null);
} }
...@@ -77,5 +61,48 @@ export class ToggleEditorLayoutAction extends Action { ...@@ -77,5 +61,48 @@ export class ToggleEditorLayoutAction extends Action {
} }
} }
export class SwitchToVerticalEditorGroupLayoutAction extends Action {
public static ID = 'workbench.action.verticalEditorGroupLayout';
public static LABEL = nls.localize('verticalEditorGroupLayout', "Switch to Vertical Editor Group Layout");
constructor(
id: string,
label: string,
@IEditorGroupService private editorGroupService: IEditorGroupService
) {
super(id, label);
}
public run(): TPromise<any> {
this.editorGroupService.setGroupOrientation('vertical');
return TPromise.as(null);
}
}
export class SwitchToHorizontalEditorGroupLayoutAction extends Action {
public static ID = 'workbench.action.horizontalEditorGroupLayout';
public static LABEL = nls.localize('horizontalEditorGroupLayout', "Switch to Horizontal Editor Group Layout");
constructor(
id: string,
label: string,
@IEditorGroupService private editorGroupService: IEditorGroupService
) {
super(id, label);
}
public run(): TPromise<any> {
this.editorGroupService.setGroupOrientation('horizontal');
return TPromise.as(null);
}
}
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions); const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleEditorLayoutAction, ToggleEditorLayoutAction.ID, ToggleEditorLayoutAction.LABEL, { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_1, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_1 } }), 'View: Toggle Vertical/Horizontal Layout', nls.localize('view', "View")); const group = nls.localize('view', "View");
\ No newline at end of file registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleEditorLayoutAction, ToggleEditorLayoutAction.ID, ToggleEditorLayoutAction.LABEL, { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_1, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_1 } }), 'View: Toggle Vertical/Horizontal Layout', group);
registry.registerWorkbenchAction(new SyncActionDescriptor(SwitchToHorizontalEditorGroupLayoutAction, SwitchToHorizontalEditorGroupLayoutAction.ID, SwitchToHorizontalEditorGroupLayoutAction.LABEL), 'View: Switch to Horizontal Editor Group Layout', group);
registry.registerWorkbenchAction(new SyncActionDescriptor(SwitchToVerticalEditorGroupLayoutAction, SwitchToVerticalEditorGroupLayoutAction.ID, SwitchToVerticalEditorGroupLayoutAction.LABEL), 'View: Switch to Vertical Editor Group Layout', group);
\ No newline at end of file
...@@ -34,7 +34,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti ...@@ -34,7 +34,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IMessageService, IMessageWithAction, Severity } from 'vs/platform/message/common/message'; import { IMessageService, IMessageWithAction, Severity } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { IEditorGroupService, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { IProgressService } from 'vs/platform/progress/common/progress'; import { IProgressService } from 'vs/platform/progress/common/progress';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor'; import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { EditorStacksModel, EditorGroup, EditorIdentifier } from 'vs/workbench/common/editor/editorStacksModel'; import { EditorStacksModel, EditorGroup, EditorIdentifier } from 'vs/workbench/common/editor/editorStacksModel';
...@@ -804,6 +804,14 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService ...@@ -804,6 +804,14 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
this.sideBySideControl.arrangeGroups(arrangement); this.sideBySideControl.arrangeGroups(arrangement);
} }
public setGroupOrientation(orientation: GroupOrientation): void {
this.sideBySideControl.setGroupOrientation(orientation);
}
public getGroupOrientation(): GroupOrientation {
return this.sideBySideControl.getGroupOrientation();
}
public createContentArea(parent: Builder): Builder { public createContentArea(parent: Builder): Builder {
// Content Container // Content Container
......
...@@ -21,7 +21,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; ...@@ -21,7 +21,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { isMacintosh } from 'vs/base/common/platform'; import { isMacintosh } from 'vs/base/common/platform';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { Position, POSITIONS } from 'vs/platform/editor/common/editor'; import { Position, POSITIONS } from 'vs/platform/editor/common/editor';
import { IEditorGroupService, GroupArrangement } from 'vs/workbench/services/group/common/groupService'; import { IEditorGroupService, GroupArrangement, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor'; import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
...@@ -77,6 +77,9 @@ export interface ISideBySideEditorControl { ...@@ -77,6 +77,9 @@ export interface ISideBySideEditorControl {
arrangeGroups(arrangement: GroupArrangement): void; arrangeGroups(arrangement: GroupArrangement): void;
setGroupOrientation(orientation: GroupOrientation): void;
getGroupOrientation(): GroupOrientation;
getRatio(): number[]; getRatio(): number[];
dispose(): void; dispose(): void;
} }
...@@ -105,6 +108,8 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti ...@@ -105,6 +108,8 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
private dragging: boolean; private dragging: boolean;
private layoutVertically: boolean; private layoutVertically: boolean;
private configuredGroupOrientation: GroupOrientation;
private showTabs: boolean; private showTabs: boolean;
private showIcons: boolean; private showIcons: boolean;
...@@ -200,31 +205,31 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti ...@@ -200,31 +205,31 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
} }
private onConfigurationUpdated(config: IWorkbenchEditorConfiguration, refresh?: boolean): void { private onConfigurationUpdated(config: IWorkbenchEditorConfiguration, refresh?: boolean): void {
let configuredGroupOrientation: GroupOrientation;
if (config.workbench && config.workbench.editor) { if (config.workbench && config.workbench.editor) {
this.showTabs = config.workbench.editor.showTabs; this.showTabs = config.workbench.editor.showTabs;
this.showIcons = config.workbench.editor.showIcons; this.showIcons = config.workbench.editor.showIcons;
this.layoutVertically = (config.workbench.editor.sideBySideLayout !== 'horizontal'); configuredGroupOrientation = (config.workbench.editor.sideBySideLayout === 'horizontal') ? 'horizontal' : 'vertical';
} else { } else {
this.showTabs = true; this.showTabs = true;
this.showIcons = false; this.showIcons = false;
this.layoutVertically = true; configuredGroupOrientation = 'vertical';
}
// Only once on startup
if (types.isUndefined(this.layoutVertically)) {
this.layoutVertically = (configuredGroupOrientation !== 'horizontal');
this.configuredGroupOrientation = configuredGroupOrientation;
} }
if (!refresh) { if (!refresh) {
return; // return early if no refresh is needed return; // return early if no refresh is needed
} }
// Editor Layout // Find out if editor layout changed in configuration
const verticalLayouting = this.parent.hasClass('vertical-layout'); if (this.configuredGroupOrientation !== configuredGroupOrientation) {
if (verticalLayouting !== this.layoutVertically) { this.configuredGroupOrientation = configuredGroupOrientation;
this.parent.removeClass('vertical-layout', 'horizontal-layout'); this.setGroupOrientation(this.configuredGroupOrientation);
this.parent.addClass(this.layoutVertically ? 'vertical-layout' : 'horizontal-layout');
this.sashOne.setOrientation(this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL);
this.sashTwo.setOrientation(this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL);
// Trigger layout
this.arrangeGroups(GroupArrangement.EVEN);
} }
// Editor Containers // Editor Containers
...@@ -754,6 +759,27 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti ...@@ -754,6 +759,27 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this.layoutContainers(); this.layoutContainers();
} }
public setGroupOrientation(orientation: GroupOrientation): void {
this.layoutVertically = (orientation !== 'horizontal');
// Editor Layout
const verticalLayouting = this.parent.hasClass('vertical-layout');
if (verticalLayouting !== this.layoutVertically) {
this.parent.removeClass('vertical-layout', 'horizontal-layout');
this.parent.addClass(this.layoutVertically ? 'vertical-layout' : 'horizontal-layout');
this.sashOne.setOrientation(this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL);
this.sashTwo.setOrientation(this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL);
// Trigger layout
this.arrangeGroups(GroupArrangement.EVEN);
}
}
public getGroupOrientation(): GroupOrientation {
return this.layoutVertically ? 'vertical' : 'horizontal';
}
public arrangeGroups(arrangement: GroupArrangement): void { public arrangeGroups(arrangement: GroupArrangement): void {
if (!this.dimension) { if (!this.dimension) {
return; // too early return; // too early
......
...@@ -11,7 +11,7 @@ import URI from 'vs/base/common/uri'; ...@@ -11,7 +11,7 @@ import URI from 'vs/base/common/uri';
import { IEditor, ICommonCodeEditor, IEditorViewState, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/editorCommon'; import { IEditor, ICommonCodeEditor, IEditorViewState, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/editorCommon';
import { IEditorInput, IEditorModel, IEditorOptions, ITextEditorOptions, IResourceInput, Position } from 'vs/platform/editor/common/editor'; import { IEditorInput, IEditorModel, IEditorOptions, ITextEditorOptions, IResourceInput, Position } from 'vs/platform/editor/common/editor';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { IEditorGroupService, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { SyncDescriptor, AsyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { SyncDescriptor, AsyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation';
import { IModel } from 'vs/editor/common/editorCommon'; import { IModel } from 'vs/editor/common/editorCommon';
...@@ -861,7 +861,7 @@ export interface IWorkbenchEditorConfiguration { ...@@ -861,7 +861,7 @@ export interface IWorkbenchEditorConfiguration {
enablePreview: boolean; enablePreview: boolean;
enablePreviewFromQuickOpen: boolean; enablePreviewFromQuickOpen: boolean;
openPositioning: 'left' | 'right' | 'first' | 'last'; openPositioning: 'left' | 'right' | 'first' | 'last';
sideBySideLayout: 'vertical' | 'horizontal'; sideBySideLayout: GroupOrientation;
} }
}; };
} }
......
...@@ -78,7 +78,7 @@ configurationRegistry.registerConfiguration({ ...@@ -78,7 +78,7 @@ configurationRegistry.registerConfiguration({
'type': 'string', 'type': 'string',
'enum': ['vertical', 'horizontal'], 'enum': ['vertical', 'horizontal'],
'default': 'vertical', 'default': 'vertical',
'description': nls.localize('sideBySideLayout', "Controls if side by side editors should layout horizontally or vertically.") 'description': nls.localize('sideBySideLayout', "Controls if editors showing side by side should layout horizontally or vertically.")
}, },
'workbench.editor.showTabs': { 'workbench.editor.showTabs': {
'type': 'boolean', 'type': 'boolean',
......
...@@ -15,6 +15,8 @@ export enum GroupArrangement { ...@@ -15,6 +15,8 @@ export enum GroupArrangement {
EVEN EVEN
} }
export type GroupOrientation = 'vertical' | 'horizontal';
export const IEditorGroupService = createDecorator<IEditorGroupService>('editorGroupService'); export const IEditorGroupService = createDecorator<IEditorGroupService>('editorGroupService');
/** /**
...@@ -62,6 +64,17 @@ export interface IEditorGroupService { ...@@ -62,6 +64,17 @@ export interface IEditorGroupService {
*/ */
arrangeGroups(arrangement: GroupArrangement): void; arrangeGroups(arrangement: GroupArrangement): void;
/**
* Changes the editor group layout between vertical and horizontal orientation. Only applies
* if more than one editor is opened.
*/
setGroupOrientation(orientation: GroupOrientation): void;
/**
* Returns the current editor group layout.
*/
getGroupOrientation(): GroupOrientation;
/** /**
* Adds the pinned state to an editor, removing it from being a preview editor. * Adds the pinned state to an editor, removing it from being a preview editor.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册