Enable Azure Data Studio's database selector to behave like SSMS' (#16681)

* Enable Azure Data Studio's database selector to behave like the one in SSMS

* Revert "Enable Azure Data Studio's database selector to behave like the one in SSMS"

This reverts commit d146eef998a3192f76df80794a31a45c8be7f786.

* Database selector auto commits selection

* Adds comment explaining change

* Auto commits selected database on blur

* Confirms db name changed before committing db selection

* Moves changed db check to selected database method

* Makes use of dbName instead of having to get value from dropdown

* Code review change
This commit is contained in:
Lewis Sanchez
2021-08-23 11:26:33 -07:00
committed by GitHub
parent e0285d344f
commit 02dbac3b5f

View File

@@ -594,6 +594,10 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
placeholder: this._selectDatabaseString,
ariaLabel: this._selectDatabaseString
});
// Allows database selector to commit typed or pasted DB names without the need to click
// or press enter to make a selection when focus is moved away from the selector.
this._register(this._dropdown.onBlur(() => this.databaseSelected(this._dropdown.value)));
this._register(this._dropdown.onValueChange(s => this.databaseSelected(s)));
this._register(this._dropdown.onFocus(() => this.onDropdownFocus()));
this._register(this.connectionManagementService.onConnectionChanged(params => this.onConnectionChanged(params)));
@@ -648,6 +652,11 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
if (!dbName) {
return;
}
if (dbName === this.getCurrentDatabaseName()) {
return;
}
if (!this._editor.input) {
this.logService.error('editor input was null');
return;