Have ENTER fire accept in QuickTree (#285289)

Fixes https://github.com/microsoft/vscode/issues/278700
This commit is contained in:
Tyler James Leonhardt
2025-12-29 00:48:22 -06:00
committed by GitHub
parent f5db09f6d6
commit 7af6f94cf4
@@ -36,11 +36,12 @@ export class QuickTree<T extends IQuickTreeItem> extends QuickInput implements I
private readonly _onDidChangeCheckboxState = this._register(new Emitter<T>());
readonly onDidChangeCheckboxState: Event<T> = this._onDidChangeCheckboxState.event;
private readonly _onDidAcceptEmitter = this._register(new Emitter<void>());
readonly onDidAccept: Event<void>;
constructor(ui: QuickInputUI) {
super(ui);
this.onDidAccept = ui.onDidAccept;
this.onDidAccept = Event.any(ui.onDidAccept, this._onDidAcceptEmitter.event);
this._registerAutoruns();
this._register(ui.tree.onDidChangeCheckedLeafItems(e => this._onDidChangeCheckedLeafItems.fire(e as T[])));
this._register(ui.tree.onDidChangeCheckboxState(e => this._onDidChangeCheckboxState.fire(e.item as T)));
@@ -243,7 +244,6 @@ export class QuickTree<T extends IQuickTreeItem> extends QuickInput implements I
* @param inBackground Whether you are accepting an item in the background and keeping the picker open.
*/
accept(_inBackground?: boolean): void {
// No-op for now since we expect only multi-select quick trees which don't need
// the speed of accept.
this._onDidAcceptEmitter.fire();
}
}