Use resolver service for custom editor

This commit is contained in:
Logan Ramos 2021-07-07 12:53:19 -04:00
parent e3cc7d0cae
commit 85fdb6abb1
No known key found for this signature in database
GPG key ID: D9CCFF14F0B18183

View file

@ -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 {