Same editor appears twice in tabs (fix #88551)

This commit is contained in:
Benjamin Pasero
2020-01-14 08:34:31 +01:00
parent bf350ef870
commit 52702da6ef
2 changed files with 4 additions and 2 deletions
@@ -26,7 +26,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { EditorMemento } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorActivation, IEditorOptions } from 'vs/platform/editor/common/editor';
@@ -182,7 +182,8 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
options = EditorOptions.create(preservingOptions);
}
this.editorService.openEditor(binaryDiffInput, options, this.group);
// Replace this editor with the binary one
this.editorService.replaceEditors([{ editor: input, replacement: binaryDiffInput, options }], this.group || ACTIVE_GROUP);
return true;
}
@@ -32,6 +32,7 @@ export class DiffEditorInput extends SideBySideEditorInput {
if (!super.matches(otherInput)) {
return false;
}
return otherInput instanceof DiffEditorInput && otherInput.forceOpenAsBinary === this.forceOpenAsBinary;
}