mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Fix language flavor change on connection when in sqlcmd mode (#17719)
* Fix language flavor change on connection when in sqlcmd mode * comment + fix
This commit is contained in:
@@ -49,6 +49,8 @@ import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { QueryEditorInput } from 'sql/workbench/common/editor/query/queryEditorInput';
|
||||
|
||||
export class ConnectionManagementService extends Disposable implements IConnectionManagementService {
|
||||
|
||||
@@ -950,9 +952,12 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
return this._providers.get(connection.providerName).onReady.then((provider) => {
|
||||
provider.connect(uri, connectionInfo);
|
||||
this._onConnectRequestSent.fire();
|
||||
|
||||
// Connections are made per URI so while there may possibly be multiple editors with
|
||||
// that URI they all share the same state
|
||||
const editor = this._editorService.findEditors(URI.parse(uri))[0]?.editor;
|
||||
// TODO make this generic enough to handle non-SQL languages too
|
||||
this.doChangeLanguageFlavor(uri, 'sql', connection.providerName);
|
||||
const language = editor instanceof QueryEditorInput && editor.state.isSqlCmdMode ? 'sqlcmd' : 'sql';
|
||||
this.doChangeLanguageFlavor(uri, language, connection.providerName);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user