feat(ui): add as-you-type filtering to the slash command menu - #91
Draft
aryansk wants to merge 1 commit into
Draft
feat(ui): add as-you-type filtering to the slash command menu#91aryansk wants to merge 1 commit into
aryansk wants to merge 1 commit into
Conversation
Enables questionary's search filter so typing narrows the slash menu (e.g. "oll" filters to /ollama) while arrow keys, Enter, and Esc keep working; j/k navigation is disabled because the filter consumes those keys. Closes shauryagangrade#61.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The interactive slash menu (
/then arrow keys) lists 12 commands with noway to filter. Users who remember part of a command (e.g. "ollama") have to
scroll and read every entry. Closes #61.
Change
Enables questionary's built-in as-you-type search filter in
_show_slash_menu(gcode/ui.py):filters to
/ollamaand anything else containing "oll".cancels (returns
"").rejects combining it with the search filter (j/k are part of the prefix).
so the menu is never empty.
The instruction line now reads
(↑↓ navigate, type to filter, Enter select, Esc cancel).Why this approach
questionary (already a dependency, pinned
>=2.1.1) ships this filter —no new dependency, no custom key-binding code, and the interaction (typing,
backspace, Enter, Esc) is the library's own well-tested behavior.
Testing
Acceptance criteria covered: "oll" filters to
/ollama(substring match onthe command label), and arrow keys/Esc behavior is preserved (tested via
the mocked select call and cancel paths).
Documentation and release impact
Review notes
behavior), not fuzzy-scored; matches the issue's prefix example ("oll").
test_ui.pycoverage) may touchtests/test_ui.py; a trivial rebase may be needed if both merge — happyto do it.