mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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 { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
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 {
|
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) => {
|
return this._providers.get(connection.providerName).onReady.then((provider) => {
|
||||||
provider.connect(uri, connectionInfo);
|
provider.connect(uri, connectionInfo);
|
||||||
this._onConnectRequestSent.fire();
|
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
|
// 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;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user