diff --git a/src/sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors.ts b/src/sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors.ts index 1436116401..8a1e7c9273 100644 --- a/src/sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors.ts +++ b/src/sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors.ts @@ -403,7 +403,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements input.connectionProfile = new ConnectionProfile(this._capabilitiesService, options.connectionProfile); if (isUntitled) { let untitledModel = await input.textInput.resolve(); - untitledModel.load(); + await untitledModel.load(); input.untitledEditorModel = untitledModel; } let editor = await this._editorService.openEditor(input, editorOptions, viewColumnToEditorGroup(this._editorGroupService, options.position)); diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index bac156956e..ca5cb87144 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -532,7 +532,9 @@ export class EditorService extends Disposable implements EditorServiceImpl { const untitledInput = input; if (untitledInput.forceUntitled || !untitledInput.resource || (untitledInput.resource && untitledInput.resource.scheme === Schemas.untitled)) { // {{SQL CARBON EDIT}} - return convertEditorInput(this.untitledEditorService.createOrGet(untitledInput.resource, untitledInput.mode, untitledInput.contents, untitledInput.encoding), undefined, this.instantiationService); + // Need to get mode for QueryEditor and Notebook + let mode: string = untitledInput.mode ? untitledInput.mode : getFileMode(this.instantiationService, untitledInput.resource); + return convertEditorInput(this.untitledEditorService.createOrGet(untitledInput.resource, mode, untitledInput.contents, untitledInput.encoding), undefined, this.instantiationService); } // Resource Editor Support