[FEATURE] Slash command autocomplete should use prefix-stable ordering instead of re-ranking on every keystroke
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
The slash command autocomplete dropdown re-ranks candidates on every keystroke, which causes the top suggestion to change unpredictably as you type. This punishes fast typists who read the suggestion, begin confirming it by typing the next character (rather than pressing Tab), and find a different command has taken the top position by the time their keystroke lands.
Example: typing /w shows /write-description as the top match. I see it, intend to narrow toward it, and type r. By the time /wr is evaluated, the dropdown re-ranks and now shows /wrap-up at the top - a different command that also matches the prefix but scored higher on some secondary signal (recency, frequency, edit distance).
This is a race condition between human intent and machine re-evaluation. The autocomplete treats every keystroke as a fresh fuzzy query. For power users who type ahead of the dropdown, this makes the autocomplete actively hostile - you can't trust it to converge on the result you're already heading toward.
Fish shell guarantees prefix-stable completion ordering for this reason.
Proposed Solution
- Once a candidate appears in the dropdown and the user types a character that is consistent with that candidate's prefix, that candidate must not drop in rank or disappear. This is the core invariant: prefix-compatible keystrokes must not demote existing matches.
- New candidates may appear below existing prefix-matches, but the visible ordering of already-shown items should remain stable as long as they still match.
- Fuzzy/non-prefix matches can still appear, but ranked below all prefix matches.This is a strict prefix-stability guarantee, not a request to remove fuzzy matching entirely. The two can coexist: prefix matches pinned at top in stable order, fuzzy matches below.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
- I type
/cto run/compact. The dropdown shows/compactas the top suggestion. - I see it, and type
oto narrow further. My keystroke lands in ~80ms. - By the time the dropdown re-evaluates
/co, it re-ranks and now shows/configat the top (perhaps because I used it more recently). - I've already glanced away from the dropdown and hit Enter, expecting
/compact. I get/configinstead. - This happens on virtually every slash command invocation when typing at normal speed. The faster you type, the worse it gets.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗