From 1dfded76c7fef8a1f1850232deae7b22395a34cf Mon Sep 17 00:00:00 2001 From: Logan Ramos Date: Thu, 2 Sep 2021 11:17:51 -0400 Subject: [PATCH] Respect canHandleDiff optionality --- .../services/editor/browser/editorResolverService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/services/editor/browser/editorResolverService.ts b/src/vs/workbench/services/editor/browser/editorResolverService.ts index 8cc2d7883bd..3d6a9c51f3b 100644 --- a/src/vs/workbench/services/editor/browser/editorResolverService.ts +++ b/src/vs/workbench/services/editor/browser/editorResolverService.ts @@ -186,7 +186,9 @@ export class EditorResolverService extends Disposable implements IEditorResolver // If no override we take the selected editor id so that matches works with the isActive check untypedEditor.options = { override: selectedEditor.editorInfo.id, ...untypedEditor.options }; - const handlesDiff = typeof selectedEditor.options?.canHandleDiff === 'function' ? selectedEditor.options.canHandleDiff() : selectedEditor.options?.canHandleDiff; + let handlesDiff = typeof selectedEditor.options?.canHandleDiff === 'function' ? selectedEditor.options.canHandleDiff() : selectedEditor.options?.canHandleDiff; + // Also check that it has a factory function or else it doesn't matter + handlesDiff = handlesDiff && selectedEditor.createDiffEditorInput !== undefined; if (handlesDiff === false && isResourceDiffEditorInput(untypedEditor)) { return ResolvedStatus.NONE; }