[BUG] Slash command autocomplete should prioritize exact matches over prefix matches
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When typing a slash command that exactly matches a user-defined command, the autocomplete incorrectly suggests a plugin command that has the user's command as a prefix.
What Should Happen?
Exact matches should be prioritized over prefix matches. Typing /optimize should suggest the /optimize command first, with /optimize-query as a secondary option, and the user should not have to cycle down to intended command that is exactly written already.
Error Messages/Logs
Steps to Reproduce
- Have a user-defined command at ~/.claude/commands/optimize.md
- Have a plugin that provides a command like /optimize-query (e.g., sql-query-optimizer plugin)
- Type /optimize in the prompt
- Observe that autocomplete suggests /optimize-query instead of /optimize
Expected behavior:
Exact matches should be prioritized over prefix matches. Typing /optimize should suggest the /optimize command first, with /optimize-query as a secondary option.
Actual behavior:
The prefix match /optimize-query appears in the popup and gets selected, even though an exact match /optimize exists. User must cycle down to use the intended command.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.64 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗