From ab3a64604af34cad66d986244b52a23499c513e8 Mon Sep 17 00:00:00 2001 From: Yurong He Date: Tue, 21 May 2019 18:56:28 -0700 Subject: [PATCH] =?UTF-8?q?Fixed=20#5546.=20Add=20missing=20line=20for=20v?= =?UTF-8?q?scode=20merge=20and=20wait=20for=20untitledM=E2=80=A6=20(#5567)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed #5546. Add missing line for vscode merge and wait for untitledModel.load --- .../api/node/mainThreadNotebookDocumentsAndEditors.ts | 2 +- src/vs/workbench/services/editor/browser/editorService.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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