Skip to content

feat: add keyboard selection for slash completions#580

Open
miloquinn wants to merge 1 commit into
Nano-Collective:mainfrom
miloquinn:feat-slash-completion-selection
Open

feat: add keyboard selection for slash completions#580
miloquinn wants to merge 1 commit into
Nano-Collective:mainfrom
miloquinn:feat-slash-completion-selection

Conversation

@miloquinn

Copy link
Copy Markdown

Summary

  • Track the selected slash-command completion in shared UI state
  • Use Up/Down to move through visible slash completions with wraparound
  • Use Enter to fill the selected command into the input
  • Use Escape to dismiss the completion list without triggering the clear-input prompt
  • Highlight the selected completion with the same marker pattern as file suggestions

Why

The slash completion menu was display-only unless there was exactly one match. When multiple commands matched, users could not navigate the menu or select a highlighted command with Enter, even though the UI already showed a completion list.

This implements the keyboard-selection behavior requested in #575 while preserving existing file-autocomplete priority.

Testing

  • npm run test:types
  • npx ava source/hooks/useUIState.spec.ts source/components/user-input.spec.tsx --timeout=60s
  • npm run test:format -- source/hooks/useUIState.ts source/hooks/useUIState.spec.ts source/components/user-input.tsx source/components/user-input.spec.tsx
  • git diff --check

Note: test:format reports existing Biome config schema/deprecation infos, but no formatting errors after this change.

- Track selected slash-completion index in shared UI state
- Let Up/Down navigate command completions with wraparound
- Let Enter fill the selected slash command and Escape dismiss the menu
- Highlight the selected command in the completion list
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.

1 participant