From 5d4afae61611fb30decc5736b0080e4abe724cf5 Mon Sep 17 00:00:00 2001 From: Monica Gupta Date: Tue, 1 Sep 2020 15:43:37 -0700 Subject: [PATCH] Sets language mode based on connection type (#12065) Co-authored-by: Monica Gupta --- src/sql/workbench/contrib/query/browser/queryEditor.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sql/workbench/contrib/query/browser/queryEditor.ts b/src/sql/workbench/contrib/query/browser/queryEditor.ts index 6077acb549..d2b5c547eb 100644 --- a/src/sql/workbench/contrib/query/browser/queryEditor.ts +++ b/src/sql/workbench/contrib/query/browser/queryEditor.ts @@ -38,6 +38,7 @@ import * as queryContext from 'sql/workbench/contrib/query/common/queryContext'; import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar'; import * as actions from 'sql/workbench/contrib/query/browser/queryActions'; import { IRange } from 'vs/editor/common/core/range'; +import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput'; const QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'queryEditorViewState'; @@ -267,6 +268,10 @@ export class QueryEditor extends BaseEditor { // TODO: Make it more generic, some way for extensions to register the commands it supports if ((!fileExtension && connectionProfile?.providerName === 'KUSTO') || this.modeService.getExtensions('Kusto').indexOf(fileExtension) > -1) { + if (this.input instanceof UntitledQueryEditorInput) { // Sets proper language mode for untitled query editor based on the connection selected by user. + this.input.setMode('kusto'); + } + content = [ { action: this._runQueryAction }, { action: this._cancelQueryAction },