mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 17:23:25 -05:00
Fix for switching active queries using file explorer (#17024)
* debug messages to figure out what is calling this * added existing connection handling. * added timeout for isConnected * restored connectionStatusManager * added timeout for updating the connection state * added existing profile check in queryInputFactory * moved existing profile check to outer * added to nonSync * added mock getConnectionProfile * added push instead of assign * added additional tests * removed getConnectionProfile * added test message for getConnectionProfile * fixed tests, need to add more * added working tests * moved connect to helper method * rearranged test order and added sync * changed wording * small capitalization change
This commit is contained in:
@@ -56,18 +56,8 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
open: false, initalContent: content
|
||||
}) as UntitledQueryEditorInput;
|
||||
}
|
||||
const profile = getCurrentGlobalConnection(this.objectExplorerService, this.connectionManagementService, this.editorService);
|
||||
if (profile) {
|
||||
const options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: undefined, input: queryEditorInput },
|
||||
saveTheConnection: false,
|
||||
showDashboard: false,
|
||||
showConnectionDialogOnError: true,
|
||||
showFirewallRuleOnError: true
|
||||
};
|
||||
this.connectionManagementService.connect(profile, queryEditorInput.uri, options).catch(err => onUnexpectedError(err));
|
||||
}
|
||||
|
||||
this.connectInput(queryEditorInput);
|
||||
return queryEditorInput;
|
||||
}
|
||||
|
||||
@@ -82,21 +72,28 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const profile = getCurrentGlobalConnection(this.objectExplorerService, this.connectionManagementService, this.editorService);
|
||||
if (profile) {
|
||||
const options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: undefined, input: queryEditorInput },
|
||||
saveTheConnection: false,
|
||||
showDashboard: false,
|
||||
showConnectionDialogOnError: true,
|
||||
showFirewallRuleOnError: true
|
||||
};
|
||||
this.connectionManagementService.connect(profile, queryEditorInput.uri, options).catch(err => onUnexpectedError(err));
|
||||
}
|
||||
|
||||
this.connectInput(queryEditorInput);
|
||||
return queryEditorInput;
|
||||
}
|
||||
|
||||
private connectInput(queryEditorInput: QueryEditorInput): void {
|
||||
const existingProfile = this.connectionManagementService.getConnectionProfile(queryEditorInput.uri);
|
||||
// Create new connection if only there is no existing connectionProfile with the uri.
|
||||
if (!existingProfile) {
|
||||
const profile = getCurrentGlobalConnection(this.objectExplorerService, this.connectionManagementService, this.editorService);
|
||||
if (profile) {
|
||||
const options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: undefined, input: queryEditorInput },
|
||||
saveTheConnection: false,
|
||||
showDashboard: false,
|
||||
showConnectionDialogOnError: true,
|
||||
showFirewallRuleOnError: true
|
||||
};
|
||||
this.connectionManagementService.connect(profile, queryEditorInput.uri, options).catch(err => onUnexpectedError(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createBase(activeEditor: QueryEditorInput): IEditorInput {
|
||||
return activeEditor.text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user