diff --git a/src/sql/workbench/services/connection/browser/connectionDialogService.ts b/src/sql/workbench/services/connection/browser/connectionDialogService.ts index 475d734b71..f04de414b8 100644 --- a/src/sql/workbench/services/connection/browser/connectionDialogService.ts +++ b/src/sql/workbench/services/connection/browser/connectionDialogService.ts @@ -69,11 +69,9 @@ export class ConnectionDialogService implements IConnectionDialogService { private _providerNameToDisplayNameMap: { [providerDisplayName: string]: string } = {}; private _providerTypes: string[] = []; private _currentProviderType: string = Constants.mssqlProviderName; - private _previousProviderType: string = undefined; private _connecting: boolean = false; private _connectionErrorTitle = localize('connectionError', 'Connection error'); private _dialogDeferredPromise: Deferred; - private _toDispose = []; /** * This is used to work around the interconnectedness of this code @@ -356,9 +354,12 @@ export class ConnectionDialogService implements IConnectionDialogService { } private createModel(model: IConnectionProfile): ConnectionProfile { - let defaultProvider = this.getDefaultProviderName(); + const defaultProvider = this.getDefaultProviderName(); let providerName = model ? model.providerName : defaultProvider; providerName = providerName ? providerName : defaultProvider; + if (model && !model.providerName) { + model.providerName = providerName; + } let newProfile = new ConnectionProfile(this._capabilitiesService, model || providerName); newProfile.saveProfile = true; newProfile.generateNewId(); @@ -441,18 +442,10 @@ export class ConnectionDialogService implements IConnectionDialogService { this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input)); this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection()); this._connectionDialog.render(); - this._previousProviderType = this._currentProviderType; } this._connectionDialog.newConnectionParams = params; - // if provider changed - if ((this._previousProviderType !== this._currentProviderType) || - // or if currentProvider not set correctly yet - !(this._currentProviderType === Constants.cmsProviderName && params.providers && params.providers.length > 1)) { - this._previousProviderType = undefined; - this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this.getDefaultProviderName()]); - } else { - this._connectionDialog.newConnectionParams = params; - } + this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this._currentProviderType]); + return new Promise(() => { this._connectionDialog.open(this._connectionManagementService.getRecentConnections(params.providers).length > 0); this.uiController.focusOnOpen();