Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a setting for configuring open direction for "open to the side" #49523

Merged
merged 2 commits into from
May 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/vs/workbench/common/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ export interface IWorkbenchEditorPartConfiguration {
enablePreviewFromQuickOpen?: boolean;
closeOnFileDelete?: boolean;
openPositioning?: 'left' | 'right' | 'first' | 'last';
openToTheSideDirection?: 'left' | 'right' | 'up' | 'down';
revealIfOpen?: boolean;
swipeToNavigate?: boolean;
labelFormat?: 'default' | 'short' | 'medium' | 'long';
Expand Down
6 changes: 6 additions & 0 deletions src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ configurationRegistry.registerConfiguration({
'default': 'right',
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorOpenPositioning' }, "Controls where editors open. Select 'left' or 'right' to open editors to the left or right of the currently active one. Select 'first' or 'last' to open editors independently from the currently active one.")
},
'workbench.editor.openToTheSideDirection': {
'type': 'string',
'enum': ['left', 'right', 'up', 'down'],
'default': 'right',
'description': nls.localize('openToTheSideDirection', "Controls where editors opened through the Open to Side option open. ")
},
'workbench.editor.revealIfOpen': {
'type': 'boolean',
'description': nls.localize('revealIfOpen', "Controls if an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, e.g. when forcing an editor to open in a specific group or to the side of the currently active group."),
Expand Down
12 changes: 11 additions & 1 deletion src/vs/workbench/services/editor/browser/nextEditorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,17 @@ export class NextEditorService extends Disposable implements INextEditorService
}

private createSideBySideGroup(): INextEditorGroup {
return this.nextEditorGroupsService.addGroup(this.nextEditorGroupsService.activeGroup, GroupDirection.RIGHT); // TODO@grid this should use an existing side group if there is one
const direction = this.configurationService.getValue<'left' | 'right' | 'up' | 'down'>('workbench.editor.openToTheSideDirection');

let groupDirection: GroupDirection = GroupDirection.RIGHT;
switch (direction) {
case 'left': groupDirection = GroupDirection.LEFT; break;
case 'right': groupDirection = GroupDirection.RIGHT; break;
case 'up': groupDirection = GroupDirection.UP; break;
case 'down': groupDirection = GroupDirection.DOWN; break;
default: groupDirection = GroupDirection.RIGHT;
}
return this.nextEditorGroupsService.addGroup(this.nextEditorGroupsService.activeGroup, groupDirection);
}

private toOptions(options?: IEditorOptions | EditorOptions): EditorOptions {
Expand Down