Fix duplicate editor windows on reload (#16893)

This commit is contained in:
Charles Gagnon
2021-08-25 20:07:58 -07:00
committed by GitHub
parent f66a0f9761
commit 0aede16aaa
3 changed files with 7 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/u
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { NO_TYPE_ID } from 'vs/workbench/services/workingCopy/common/workingCopy';
import { IWorkingCopyEditorService } from 'vs/workbench/services/workingCopy/common/workingCopyEditorService';
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput'; // {{SQL CARBON EDIT}} Handle our untitled inputs as well
import { UNTITLED_NOTEBOOK_TYPEID } from 'sql/workbench/common/constants'; // {{SQL CARBON EDIT}} Handle our untitled inputs as well
interface ISerializedUntitledTextEditorInput {
resourceJSON: UriComponents;
@@ -101,7 +103,7 @@ export class UntitledTextEditorWorkingCopyEditorHandler extends Disposable imple
private installHandler(): void {
this._register(this.workingCopyEditorService.registerHandler({
handles: workingCopy => workingCopy.resource.scheme === Schemas.untitled && workingCopy.typeId === NO_TYPE_ID,
isOpen: (workingCopy, editor) => editor instanceof UntitledTextEditorInput && isEqual(workingCopy.resource, editor.resource),
isOpen: (workingCopy, editor) => (editor instanceof UntitledTextEditorInput || editor instanceof UntitledQueryEditorInput || editor.typeId === UNTITLED_NOTEBOOK_TYPEID) && isEqual(workingCopy.resource, editor.resource), // {{SQL CARBON EDIT}} Handle our untitled inputs as well. Notebook input can't be imported due to layering currently so just use the typeID for that
createEditor: workingCopy => {
let editorInputResource: URI;