Skip to content

Commit

Permalink
fix #127792
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored and chrmarti committed Jul 7, 2021
1 parent 4c95275 commit 62fddf3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/vs/workbench/services/editor/browser/editorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,10 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return [group, activation];
}

private doFindTargetGroup(editor: IEditorInputWithOptions | IUntypedEditorInput, preferredGroup: OpenInEditorGroup | undefined): IEditorGroup {
private doFindTargetGroup(input: IEditorInputWithOptions | IUntypedEditorInput, preferredGroup: OpenInEditorGroup | undefined): IEditorGroup {
let group: IEditorGroup | undefined;
let editor = isEditorInputWithOptions(input) ? input.editor : input;
let options = input.options;

// Group: Instance of Group
if (preferredGroup && typeof preferredGroup !== 'number') {
Expand All @@ -661,11 +663,11 @@ export class EditorService extends Disposable implements EditorServiceImpl {
}

// Group: Unspecified without a specific index to open
else if (!editor.options || typeof editor.options.index !== 'number') {
else if (!options || typeof options.index !== 'number') {
const groupsByLastActive = this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE);

// Respect option to reveal an editor if it is already visible in any group
if (editor.options?.revealIfVisible) {
if (options?.revealIfVisible) {
for (const lastActiveGroup of groupsByLastActive) {
if (lastActiveGroup.isActive(editor)) {
group = lastActiveGroup;
Expand All @@ -677,7 +679,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
// Respect option to reveal an editor if it is open (not necessarily visible)
// Still prefer to reveal an editor in a group where the editor is active though.
if (!group) {
if (editor.options?.revealIfOpened || this.configurationService.getValue<boolean>('workbench.editor.revealIfOpen')) {
if (options?.revealIfOpened || this.configurationService.getValue<boolean>('workbench.editor.revealIfOpen')) {
let groupWithInputActive: IEditorGroup | undefined = undefined;
let groupWithInputOpened: IEditorGroup | undefined = undefined;

Expand Down

0 comments on commit 62fddf3

Please sign in to comment.