From 85fdb6abb11eb4c096746effe727477b5c6be46d Mon Sep 17 00:00:00 2001 From: Logan Ramos Date: Wed, 7 Jul 2021 12:53:19 -0400 Subject: [PATCH] Use resolver service for custom editor --- .../contrib/customEditor/browser/customEditorInput.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index a28a6b53169..8aafcb14aa8 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -17,12 +17,13 @@ import { FileSystemProviderCapabilities, IFileService } from 'vs/platform/files/ import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILabelService } from 'vs/platform/label/common/label'; import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo'; -import { EditorInputCapabilities, GroupIdentifier, IEditorInput, IRevertOptions, ISaveOptions, IUntypedEditorInput, UntypedEditorContext, Verbosity } from 'vs/workbench/common/editor'; +import { EditorInputCapabilities, GroupIdentifier, IEditorInput, IRevertOptions, ISaveOptions, isEditorInputWithOptionsAndGroup, IUntypedEditorInput, UntypedEditorContext, Verbosity } from 'vs/workbench/common/editor'; import { decorateFileEditorLabel } from 'vs/workbench/common/editor/resourceEditorInput'; import { defaultCustomEditor } from 'vs/workbench/contrib/customEditor/common/contributedCustomEditors'; import { ICustomEditorModel, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor'; import { IWebviewService, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview'; import { IWebviewWorkbenchService, LazilyResolvedWebviewEditorInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService'; +import { IEditorResolverService } from 'vs/workbench/services/editor/common/editorResolverService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService'; @@ -77,7 +78,7 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput { @ILabelService private readonly labelService: ILabelService, @ICustomEditorService private readonly customEditorService: ICustomEditorService, @IFileDialogService private readonly fileDialogService: IFileDialogService, - @IEditorService private readonly editorService: IEditorService, + @IEditorResolverService private readonly editorResolverService: IEditorResolverService, @IUndoRedoService private readonly undoRedoService: IUndoRedoService, @IFileService private readonly fileService: IFileService ) { @@ -339,7 +340,8 @@ export class CustomEditorInput extends LazilyResolvedWebviewEditorInput { return { editor: this.doMove(group, newResource) }; } - return { editor: this.editorService.createEditorInput({ resource: newResource, forceFile: true }) }; + const resolvedEditor = this.editorResolverService.resolveEditor({ resource: newResource, forceFile: true }, undefined); + return isEditorInputWithOptionsAndGroup(resolvedEditor) ? { editor: resolvedEditor.editor } : undefined; } private doMove(group: GroupIdentifier, newResource: URI): IEditorInput {