mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix for database name in connection details after changing database (#22376)
This commit is contained in:
@@ -27,10 +27,13 @@ export class UntitledQueryEditorInput extends QueryEditorInput implements IUntit
|
||||
|
||||
public static readonly ID = UNTITLED_QUERY_EDITOR_TYPEID;
|
||||
|
||||
private originalConnectionUri: string;
|
||||
|
||||
constructor(
|
||||
description: string | undefined,
|
||||
text: UntitledTextEditorInput,
|
||||
results: QueryResultsInput,
|
||||
initialConnectionUri: string | undefined,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@IQueryModelService queryModelService: IQueryModelService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@@ -39,6 +42,7 @@ export class UntitledQueryEditorInput extends QueryEditorInput implements IUntit
|
||||
@IEditorResolverService private readonly editorResolverService: IEditorResolverService
|
||||
) {
|
||||
super(description, text, results, connectionManagementService, queryModelService, configurationService, instantiationService);
|
||||
this.originalConnectionUri = initialConnectionUri;
|
||||
// Set the mode explicitely to stop the auto language detection service from changing the mode unexpectedly.
|
||||
// the auto language detection service won't do the language change only if the mode is explicitely set.
|
||||
// if the mode (e.g. kusto, sql) do not exist for whatever reason, we will default it to sql.
|
||||
@@ -121,4 +125,11 @@ export class UntitledQueryEditorInput extends QueryEditorInput implements IUntit
|
||||
// Subclasses need to explicitly opt-in to being untitled.
|
||||
return EditorInputCapabilities.Untitled;
|
||||
}
|
||||
|
||||
override dispose() {
|
||||
if (this.originalConnectionUri) {
|
||||
this.connectionManagementService.disconnect(this.originalConnectionUri);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user