diff --git a/src/sql/workbench/common/constants.ts b/src/sql/workbench/common/constants.ts index c99a74db8a..b7ca98f98d 100644 --- a/src/sql/workbench/common/constants.ts +++ b/src/sql/workbench/common/constants.ts @@ -29,6 +29,8 @@ export const SearchViewFocusedKey = new RawContextKey('notebookSearchVi export const InputBoxFocusedKey = new RawContextKey('inputBoxFocus', false); export const SearchInputBoxFocusedKey = new RawContextKey('searchInputBoxFocus', false); +export const UNTITLED_NOTEBOOK_TYPEID = 'workbench.editorinputs.untitledNotebookInput'; + export const enum NotebookLanguage { Notebook = 'Notebook', Ipynb = 'ipynb' diff --git a/src/sql/workbench/contrib/notebook/browser/models/untitledNotebookInput.ts b/src/sql/workbench/contrib/notebook/browser/models/untitledNotebookInput.ts index f1bdb9f105..b5167cfa39 100644 --- a/src/sql/workbench/contrib/notebook/browser/models/untitledNotebookInput.ts +++ b/src/sql/workbench/contrib/notebook/browser/models/untitledNotebookInput.ts @@ -11,9 +11,10 @@ import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/not import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService'; import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput'; import { EditorInputCapabilities } from 'vs/workbench/common/editor'; +import { UNTITLED_NOTEBOOK_TYPEID } from 'sql/workbench/common/constants'; export class UntitledNotebookInput extends NotebookInput { - public static ID: string = 'workbench.editorinputs.untitledNotebookInput'; + public static ID: string = UNTITLED_NOTEBOOK_TYPEID; constructor( title: string, diff --git a/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.ts b/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.ts index d0e091bf2f..e46459d82a 100644 --- a/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.ts +++ b/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.ts @@ -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;