mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 09:38:38 +01:00
Add optional sortByLabel to QuickPick to control whether to re-sort items when query changes
Summary: Address issue #73904 by adding an optional `sortByLabel` to the QuickPick class which determines whether the picker re-sorts the result list when the user types in the input field. If true, the picker applies a sort to order results by the index of the first appearance of the input in the label. For backwards compatibility, this field is true by default. https://github.com/microsoft/vscode/issues/73904 Test Plan: attached video shows behavior both before and after {F167292605} note: there aren't any existing tests on what happens when the query input changes in the QuickPick Reviewers: dalongi, ericblue, hchau Reviewed By: ericblue Differential Revision: https://phabricator.intern.facebook.com/D16203434 Signature: 16203434:1562878837:5413e3852f2bd04c8e81b9fe5c4a08127dfe3b65
This commit is contained in:
committed by
Christof Marti
parent
8efa538d7d
commit
e9c0aeb8b0
@@ -54,6 +54,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
|
||||
placeHolder: options && options.placeHolder,
|
||||
matchOnDescription: options && options.matchOnDescription,
|
||||
matchOnDetail: options && options.matchOnDetail,
|
||||
sortByLabel: options && options.sortByLabel,
|
||||
ignoreFocusLost: options && options.ignoreFocusOut,
|
||||
canPickMany: options && options.canPickMany
|
||||
}, token);
|
||||
@@ -485,6 +486,7 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
|
||||
private _canSelectMany = false;
|
||||
private _matchOnDescription = true;
|
||||
private _matchOnDetail = true;
|
||||
private _sortByLabel = true;
|
||||
private _activeItems: T[] = [];
|
||||
private readonly _onDidChangeActiveEmitter = new Emitter<T[]>();
|
||||
private _selectedItems: T[] = [];
|
||||
@@ -550,6 +552,15 @@ class ExtHostQuickPick<T extends QuickPickItem> extends ExtHostQuickInput implem
|
||||
this.update({ matchOnDetail });
|
||||
}
|
||||
|
||||
get sortByLabel() {
|
||||
return this._sortByLabel;
|
||||
}
|
||||
|
||||
set sortByLabel(sortByLabel: boolean) {
|
||||
this._sortByLabel = sortByLabel;
|
||||
this.update({ sortByLabel });
|
||||
}
|
||||
|
||||
get activeItems() {
|
||||
return this._activeItems;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user