feat(ui): add as-you-type filtering to the slash command menu - #91
Closed
aryansk wants to merge 1 commit into
Closed
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.
shauryagangrade
approved these changes
Aug 15, 2026
shauryagangrade
left a comment
Owner
There was a problem hiding this comment.
Nice UX win — as-you-type filtering in the slash menu. Verified that questionary 2.1.1 (the pinned minimum) supports use_search_filter and use_jk_keys, so the config is valid; disabling j/k is correct since they conflict with the filter. The Esc/None/KeyboardInterrupt → "" contract preserves the prompt-loop behavior.
Notes (non-blocking):
test_slash_menu_choice_labels_are_searchableis a weak assertion — it checks that some label contains "oll" rather than pinning the exact filtered set. Since the filter matches substrings of the full"{cmd} — {desc}"label, "oll" will also match any command whose description contains it, not just/ollama. Consider filtering on the command token only (e.g. precomputecmd.lower()choices) for predictable results.- No test asserts the questionary call actually passes
use_search_filter=True(thetest_slash_menu_enables_type_to_filtertest does — good, ignore this if it was intentional). - Minor:
use_search_filter=Truemay affect how the existinguse_shortcuts=Falsebehaves; the test asserts both, so this is covered.
Approve — ready once you mark the PR ready for review.
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.