diff --git a/src/sql/workbench/contrib/query/browser/queryActions.ts b/src/sql/workbench/contrib/query/browser/queryActions.ts index 0eb9ec2986..4e3e6de3b2 100644 --- a/src/sql/workbench/contrib/query/browser/queryActions.ts +++ b/src/sql/workbench/contrib/query/browser/queryActions.ts @@ -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;