Compare commits

...

2 commits

Author SHA1 Message Date
Benjamin Pasero f00d30357f
only filter when quick pick is visible 2021-11-26 09:51:34 +01:00
Benjamin Pasero ca07441587
Update filter when programmatically changing quick input value 2021-11-25 09:54:55 +01:00

View file

@ -487,9 +487,21 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
}
set value(value: string) {
this.doSetValue(value);
}
private doSetValue(value: string, skipUpdate?: boolean): void {
if (this._value !== value) {
this._value = value || '';
this.update();
this._value = value;
if (!skipUpdate) {
this.update();
}
if (this.visible) {
const didFilter = this.ui.list.filter(this.filterValue(this._value));
if (didFilter) {
this.trySelectFirst();
}
}
this.onDidChangeValueEmitter.fire(this._value);
}
}
@ -734,15 +746,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
if (!this.visible) {
this.visibleDisposables.add(
this.ui.inputBox.onDidChange(value => {
if (value === this.value) {
return;
}
this._value = value;
const didFilter = this.ui.list.filter(this.filterValue(this.ui.inputBox.value));
if (didFilter) {
this.trySelectFirst();
}
this.onDidChangeValueEmitter.fire(value);
this.doSetValue(value, true /* skip update since this originates from the UI */);
}));
this.visibleDisposables.add(this.ui.inputBox.onMouseDown(event => {
if (!this.autoFocusOnList) {