Skip to content

Commit 5f726e4

Browse files
committed
1 parent a970f1c commit 5f726e4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/vs/workbench/api/browser/mainThreadEditorTabs.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import { EditorResourceAccessor, GroupModelChangeKind, SideBySideEditor } from '
1010
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
1111
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
1212
import { columnToEditorGroup, EditorGroupColumn, editorGroupToColumn } from 'vs/workbench/services/editor/common/editorGroupColumn';
13-
import { GroupDirection, IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
14-
import { IEditorsChangeEvent, IEditorService } from 'vs/workbench/services/editor/common/editorService';
13+
import { GroupDirection, IEditorGroup, IEditorGroupsService, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService';
14+
import { IEditorsChangeEvent, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
1515
import { AbstractTextResourceEditorInput } from 'vs/workbench/common/editor/textResourceEditorInput';
1616
import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput';
1717
import { CustomEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput';
1818
import { URI } from 'vs/base/common/uri';
1919
import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
2020
import { TerminalEditorInput } from 'vs/workbench/contrib/terminal/browser/terminalEditorInput';
21+
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2122

2223

2324
interface TabInfo {
@@ -40,6 +41,7 @@ export class MainThreadEditorTabs implements MainThreadEditorTabsShape {
4041
constructor(
4142
extHostContext: IExtHostContext,
4243
@IEditorGroupsService private readonly _editorGroupsService: IEditorGroupsService,
44+
@IConfigurationService private readonly _configurationService: IConfigurationService,
4345
@IEditorService editorService: IEditorService,
4446
) {
4547

@@ -444,7 +446,12 @@ export class MainThreadEditorTabs implements MainThreadEditorTabsShape {
444446
}
445447
// If group index is out of bounds then we make a new one that's to the right of the last group
446448
if (this._groupLookup.get(groupId) === undefined) {
447-
targetGroup = this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length - 1], GroupDirection.RIGHT, undefined);
449+
let direction = GroupDirection.RIGHT;
450+
// Make sure we respect the user's preferred side direction
451+
if (viewColumn === SIDE_GROUP) {
452+
direction = preferredSideBySideGroupDirection(this._configurationService);
453+
}
454+
targetGroup = this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length - 1], direction, undefined);
448455
} else {
449456
targetGroup = this._editorGroupsService.getGroup(groupId);
450457
}

0 commit comments

Comments
 (0)