diff --git a/src/sql/workbench/contrib/query/browser/flavorStatus.ts b/src/sql/workbench/contrib/query/browser/flavorStatus.ts index 763ae480fe..d63b14e285 100644 --- a/src/sql/workbench/contrib/query/browser/flavorStatus.ts +++ b/src/sql/workbench/contrib/query/browser/flavorStatus.ts @@ -187,7 +187,7 @@ export class ChangeFlavorAction extends Action { public run(): Promise { let activeEditor = this._editorService.activeEditorPane; - let currentUri = activeEditor?.input.resource?.toString(); + let currentUri = activeEditor?.input.resource?.toString(true); if (this._connectionManagementService.isConnected(currentUri)) { let currentProvider = this._connectionManagementService.getProviderIdFromUri(currentUri); return this._showMessage(Severity.Info, nls.localize('alreadyConnected', diff --git a/src/sql/workbench/contrib/query/browser/queryEditor.ts b/src/sql/workbench/contrib/query/browser/queryEditor.ts index 6d2196281a..1bb7241694 100644 --- a/src/sql/workbench/contrib/query/browser/queryEditor.ts +++ b/src/sql/workbench/contrib/query/browser/queryEditor.ts @@ -196,6 +196,9 @@ export class QueryEditor extends EditorPane { this.setTaskbarContent(); } })); + this._register(this.connectionManagementService.onLanguageFlavorChanged(() => { + this.setTaskbarContent(); + })); } /** @@ -265,9 +268,11 @@ export class QueryEditor extends EditorPane { const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures']; let connectionProfile = this.connectionManagementService.getConnectionProfile(this.input?.uri); let fileExtension = path.extname(this.input?.uri || ''); - + const providerId = connectionProfile?.providerName || + this.connectionManagementService.getProviderIdFromUri(this.input?.uri) || + this.connectionManagementService.getDefaultProviderId(); // 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 ((providerId === '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'); } @@ -282,7 +287,6 @@ export class QueryEditor extends EditorPane { ]; } else { - const notebookConvertActionsEnabled = this.configurationService.getValue('notebook')['showNotebookConvertActions']; if (previewFeaturesEnabled) { content = [ { action: this._runQueryAction }, @@ -291,13 +295,18 @@ export class QueryEditor extends EditorPane { { action: this._toggleConnectDatabaseAction }, { action: this._changeConnectionAction }, { action: this._listDatabasesAction }, - { element: separator }, - { action: this._estimatedQueryPlanAction }, // Preview - { action: this._toggleSqlcmdMode }, // Preview ]; - if (notebookConvertActionsEnabled) { - content.push({ action: this._exportAsNotebookAction }); + if (providerId === 'MSSQL') { + content.push({ element: separator }, + { action: this._estimatedQueryPlanAction }, // Preview + { action: this._toggleSqlcmdMode } // Preview) + ); + + const notebookConvertActionsEnabled = this.configurationService.getValue('notebook')['showNotebookConvertActions']; + if (notebookConvertActionsEnabled) { + content.push({ action: this._exportAsNotebookAction }); + } } } else { content = [ @@ -308,11 +317,14 @@ export class QueryEditor extends EditorPane { { action: this._changeConnectionAction }, { action: this._listDatabasesAction } ]; - const notebookConvertActionsEnabled = this.configurationService.getValue('notebook')['notebook.showNotebookConvertActions']; - if (notebookConvertActionsEnabled) { - content.push( - { element: separator }, - { action: this._exportAsNotebookAction }); + + if (providerId === 'MSSQL') { + const notebookConvertActionsEnabled = this.configurationService.getValue('notebook')['notebook.showNotebookConvertActions']; + if (notebookConvertActionsEnabled) { + content.push( + { element: separator }, + { action: this._exportAsNotebookAction }); + } } } }