added split pane options to settings (#82888)

* added split pane options to settings

* moved option to workbench config

* updating description messages

* review changes

* 💄
This commit is contained in:
Dhairya Nadapara 2019-10-21 21:28:15 +05:30 committed by Benjamin Pasero
parent aa28cc6e36
commit 0abf6cf816
4 changed files with 20 additions and 4 deletions

View file

@ -37,7 +37,8 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = {
openSideBySideDirection: 'right',
closeEmptyGroups: true,
labelFormat: 'default',
iconTheme: 'vs-seti'
iconTheme: 'vs-seti',
splitSizing: 'distribute'
};
export function impactsEditorPartOptions(event: IConfigurationChangeEvent): boolean {

View file

@ -507,7 +507,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
// Add to grid widget
this.gridWidget.addView(
newGroupView,
Sizing.Distribute,
this.getSplitSizingStyle(),
locationView,
this.toGridViewDirection(direction),
);
@ -524,6 +524,10 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
return newGroupView;
}
private getSplitSizingStyle(): Sizing {
return this._partOptions.splitSizing === 'split' ? Sizing.Split : Sizing.Distribute;
}
private doCreateGroupView(from?: IEditorGroupView | ISerializedEditorGroup | null): IEditorGroupView {
// Create group view
@ -674,7 +678,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
}
// Remove from grid widget & dispose
this.gridWidget.removeView(groupView, Sizing.Distribute);
this.gridWidget.removeView(groupView, this.getSplitSizingStyle());
groupView.dispose();
// Restore focus if we had it previously (we run this after gridWidget.removeView() is called
@ -704,7 +708,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
const restoreFocus = this.shouldRestoreFocus(sourceView.element);
// Move through grid widget API
this.gridWidget.moveView(sourceView, Sizing.Distribute, targetView, this.toGridViewDirection(direction));
this.gridWidget.moveView(sourceView, this.getSplitSizingStyle(), targetView, this.toGridViewDirection(direction));
// Restore focus if we had it previously (we run this after gridWidget.removeView() is called
// because removing a view can mean to reparent it and thus focus would be removed otherwise)

View file

@ -60,6 +60,16 @@ import { isMacintosh, isWindows, isLinux, isWeb, isNative } from 'vs/base/common
],
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the sizing of editor tabs.")
},
'workbench.editor.splitSizing': {
'type': 'string',
'enum': ['distribute', 'split'],
'default': 'distribute',
'enumDescriptions': [
nls.localize('workbench.editor.splitSizingDistribute', "Splits all the editor groups to equal parts."),
nls.localize('workbench.editor.splitSizingSplit', "Splits the active editor group to equal parts.")
],
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'splitSizing' }, "Controls the sizing of editor groups when splitting them.")
},
'workbench.editor.focusRecentEditorAfterClose': {
'type': 'boolean',
'description': nls.localize('focusRecentEditorAfterClose', "Controls whether tabs are closed in most recently used order or from left to right."),

View file

@ -1042,6 +1042,7 @@ interface IEditorPartConfiguration {
mouseBackForwardToNavigate?: boolean;
labelFormat?: 'default' | 'short' | 'medium' | 'long';
restoreViewState?: boolean;
splitSizing?: 'split' | 'distribute';
}
export interface IEditorPartOptions extends IEditorPartConfiguration {