Filter selection prompt items with search #1797
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #1546
Changes
I changed the code so that now when a user searches, the list is filtered down to only those items which match the search term
ListPromptState.csThere are now 3 lists which hold the current state of the prompt:
ItemsThis existed before and contains all the itemsVisibleItemsThis list contains only items which match the search term, or any groups which contain a child which matches the search term_selectableItemsThis list contains only the subset ofVisibleItemswhich are selectable (ie. not a group if in leaf mode, following the same logic as before with_leafIndexes). it is a list ofSelectableItemwhich contains theListPromptItemand also the index of the item inVisibleItems.VisibleItemsand_selectableItemsare updated every time the search term changes, when the user is navigates the list the only the index of the item in_selectableItemsis updated (which is stored in_selectableIndex).ListPrompt.csVisibleItemsfilterOnSearchSelectionPrompt.csFilterOnSearchpropertystate.Current == null. This happens when theVisibleItemsis filtered to the point it contains no itemsSelectionPromptExtensions.csEnableSearchmethod to setFilterOnSearchMultiSelectionPrompt.csfilterOnSearchIListPromptStrategyPlease upvote 👍 this pull request if you are interested in it.