diff --git a/src/vs/workbench/common/editor/diffEditorInput.ts b/src/vs/workbench/common/editor/diffEditorInput.ts index ce32a59ebf5..f84160ac737 100644 --- a/src/vs/workbench/common/editor/diffEditorInput.ts +++ b/src/vs/workbench/common/editor/diffEditorInput.ts @@ -6,7 +6,7 @@ import { AbstractSideBySideEditorInputSerializer, SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { EditorModel } from 'vs/workbench/common/editor/editorModel'; -import { TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID, Verbosity, IEditorDescriptor, IEditorPane, GroupIdentifier, IResourceDiffEditorInput, IEditorInput, IUntypedEditorInput, DEFAULT_EDITOR_ASSOCIATION, UntypedEditorContext, isResourceDiffEditorInput } from 'vs/workbench/common/editor'; +import { TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID, Verbosity, IEditorDescriptor, IEditorPane, GroupIdentifier, IResourceDiffEditorInput, IEditorInput, IUntypedEditorInput, DEFAULT_EDITOR_ASSOCIATION, UntypedEditorContext } from 'vs/workbench/common/editor'; import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel'; import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel'; import { TextDiffEditorModel } from 'vs/workbench/common/editor/textDiffEditorModel'; @@ -154,15 +154,15 @@ export class DiffEditorInput extends SideBySideEditorInput { } override matches(otherInput: IEditorInput | IUntypedEditorInput): boolean { - if (isResourceDiffEditorInput(otherInput)) { - return this.modified.matches(otherInput.modified) && this.original.matches(otherInput.original); - } - if (!super.matches(otherInput)) { return false; } - return otherInput instanceof DiffEditorInput && otherInput.forceOpenAsBinary === this.forceOpenAsBinary; + if (otherInput instanceof DiffEditorInput && otherInput.forceOpenAsBinary !== this.forceOpenAsBinary) { + return false; + } + + return true; } override dispose(): void { diff --git a/src/vs/workbench/common/editor/sideBySideEditorInput.ts b/src/vs/workbench/common/editor/sideBySideEditorInput.ts index c461f7db10b..758166888c9 100644 --- a/src/vs/workbench/common/editor/sideBySideEditorInput.ts +++ b/src/vs/workbench/common/editor/sideBySideEditorInput.ts @@ -132,14 +132,15 @@ export class SideBySideEditorInput extends EditorInput implements ISideBySideEdi return true; } - if (isResourceDiffEditorInput(otherInput)) { - return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original); - } - if (otherInput instanceof SideBySideEditorInput) { return this.primary.matches(otherInput.primary) && this.secondary.matches(otherInput.secondary); } + if (isResourceDiffEditorInput(otherInput)) { + // TODO@lramos15 https://github.com/microsoft/vscode/issues/127131 + return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original); + } + return false; } } diff --git a/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts b/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts index 7ab2d19c1b4..c31dfab17a7 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookDiffEditorInput.ts @@ -107,14 +107,18 @@ export class NotebookDiffEditorInput extends DiffEditorInput { return true; } - if (isResourceDiffEditorInput(otherInput)) { - return this.primary.matches(otherInput.modified) && this.secondary.matches(otherInput.original) && this.editorId !== undefined && this.editorId === otherInput.options?.override; - } - if (otherInput instanceof NotebookDiffEditorInput) { return this.viewType === otherInput.viewType && isEqual(this.resource, otherInput.resource); } + + if (isResourceDiffEditorInput(otherInput)) { + return this.modified.matches(otherInput.modified) + && this.original.matches(otherInput.original) + && this.editorId !== undefined + && this.editorId === otherInput.options?.override; + } + return false; } }