From 781f1bac0144d22bc1953f9e2ff00ea97f847994 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 6 Jan 2020 18:33:27 -0800 Subject: [PATCH] Only treat diff editors as matching if they have the same forceOpenAsBinary setting Fixes #88166 Custom editors used in diff views for binary files were broken. The root cause we were creating a `DiffEditorInput` that set `forceOpenAsBinary === true`, however this input was discarded as it was judged to be the same as the existing editor input which had `forceOpenAsBinary === undefined` The fix here is to make the `matches` function take `forceOpenAsBinary` into account --- src/vs/workbench/common/editor/diffEditorInput.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vs/workbench/common/editor/diffEditorInput.ts b/src/vs/workbench/common/editor/diffEditorInput.ts index 3b30153f526e2..12e57ac49e09d 100644 --- a/src/vs/workbench/common/editor/diffEditorInput.ts +++ b/src/vs/workbench/common/editor/diffEditorInput.ts @@ -28,6 +28,13 @@ export class DiffEditorInput extends SideBySideEditorInput { super(name, description, original, modified); } + matches(otherInput: unknown): boolean { + if (!super.matches(otherInput)) { + return false; + } + return otherInput instanceof DiffEditorInput && otherInput.forceOpenAsBinary === this.forceOpenAsBinary; + } + getTypeId(): string { return DiffEditorInput.ID; }