Skip to content

fix(tui): prioritize exact alias matches in slash-command autocomplete#1811

Closed
IIzzaya wants to merge 1 commit into
Hmbown:mainfrom
IIzzaya:izaya
Closed

fix(tui): prioritize exact alias matches in slash-command autocomplete#1811
IIzzaya wants to merge 1 commit into
Hmbown:mainfrom
IIzzaya:izaya

Conversation

@IIzzaya
Copy link
Copy Markdown
Contributor

@IIzzaya IIzzaya commented May 19, 2026

When typing a prefix like /q in the composer, the slash-command autocomplete popup sorts results alphabetically by canonical command name. This means /clear (matched via the alias qingping) appears before /exit (matched via the exact alias q). The user who types /q almost certainly wants to quit — the match quality should drive ordering.

image

This PR replaces the alphabetical sort in slash_completion_hints with a three-tier priority sort:

  • Priority 0: An alias exactly equals the prefix
  • Priority 1: The canonical command
  • Priority 2: An alias merely starts with the prefix

Within each tier, results fall back to alphabetical order. Skill entries and non-command completions (no CommandInfo) receive priority 3 and sort to the bottom.

After:

image

@IIzzaya IIzzaya changed the title Prioritize exact alias matches in slash-command autocomplete prioritize exact alias matches in slash-command autocomplete May 19, 2026
@IIzzaya IIzzaya changed the title prioritize exact alias matches in slash-command autocomplete fix(tui): prioritize exact alias matches in slash-command autocomplete May 19, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the slash_completion_hints function to prioritize command entries based on exact alias matches and prefixes. The feedback suggests optimizing the sorting logic by avoiding redundant string allocations and lookups within the comparison closure, recommending the use of &str and eq_ignore_ascii_case for better performance.

Comment thread crates/tui/src/tui/widgets/mod.rs
@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 21, 2026

Thanks for the slash-command autocomplete fix. This was harvested into v0.8.40 release PR #1823 as commit 66b4a5f, and #1823 is now CI-green. Closing as superseded by the release branch; thank you for the focused UI polish.

@Hmbown Hmbown closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants