Add Tab completion and group-name search for slash commands#12592
Open
PlunderStruck wants to merge 6 commits into
Open
Add Tab completion and group-name search for slash commands#12592PlunderStruck wants to merge 6 commits into
PlunderStruck wants to merge 6 commits into
Conversation
…ab-complete # Conflicts: # src/main/frontend/components/editor.cljs # src/main/frontend/ui.cljs
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.
Summary
This PR improves slash command autocomplete in the editor:
Tabto complete the currently highlighted slash command.Why
Slash command results already support keyboard navigation, but completing a highlighted result required
Enteror a mouse click. This makesTabwork as a completion key for the slash command picker, which matches the behavior users often expect from command/autocomplete surfaces.The group-name matching also makes it easier to discover related commands as a set. For example, typing a task-status group query can surface the status commands together instead of requiring the user to remember each individual command label.
Implementation Notes
The
Tabbehavior is implemented as an opt-in autocomplete behavior via:complete-on-tab?, enabled only for the slash command autocomplete.I chose this instead of changing the global shortcut config because binding
Tabthrough:auto-complete/completewas not reliable in the running editor. The editor's own Tab indentation handler intentionally does nothing while an editor action is active, so if the autocomplete shortcut handler misses the key, pressingTabappears to do nothing. Keeping the behavior insideui/auto-completemakes the handling local to the mounted autocomplete surface while still reusing the existingfrontend.handler.ui/auto-complete-completeselection path.Group-name matching reuses the existing slash command fuzzy search pipeline by adding group-label extractors alongside the existing localized, English, and pinyin command-name extractors.
Tests
Focused tests:
bb dev:test -v frontend.commands-testbb dev:test -v frontend.ui-testFull validation:
bb dev:lint-and-testResult:
1295tests6315assertions0failures0errorsManual verification:
/toddisplayed theTASK STATUSgroup and pressingTabcompleted the highlightedTodocommand.