diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index eb91ac79705..f85d5c0cfde 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -620,10 +620,10 @@ export abstract class TextEditorInput extends EditorInput { // Replace editor preserving viewstate (either across all groups or // only selected group) if the target is different from the current resource if (!isEqual(target, this.resource)) { - const replacement: IResourceInput = { resource: target, options: { pinned: true, viewState } }; + const replacement = this.editorService.createInput({ resource: target }); const targetGroups = replaceAllEditors ? this.editorGroupService.groups.map(group => group.id) : [group]; for (const group of targetGroups) { - await this.editorService.replaceEditors([{ editor: { resource: this.resource }, replacement }], group); + await this.editorService.replaceEditors([{ editor: this, replacement, options: { pinned: true, viewState } }], group); } } diff --git a/src/vs/workbench/services/editor/common/editorService.ts b/src/vs/workbench/services/editor/common/editorService.ts index b1404cae396..206aae8ac02 100644 --- a/src/vs/workbench/services/editor/common/editorService.ts +++ b/src/vs/workbench/services/editor/common/editorService.ts @@ -200,7 +200,7 @@ export interface IEditorService { /** * Converts a lightweight input to a workbench editor input. */ - createInput(input: IResourceEditor): IEditorInput | null; + createInput(input: IResourceEditor): IEditorInput; /** * Save the provided list of editors.