Skip to content

Feature: Add slash command autocomplete dropdown#196

Merged
PureWeen merged 6 commits intoPureWeen:mainfrom
davidnguyen-tech:feature/slash-command-autocomplete
Feb 23, 2026
Merged

Feature: Add slash command autocomplete dropdown#196
PureWeen merged 6 commits intoPureWeen:mainfrom
davidnguyen-tech:feature/slash-command-autocomplete

Conversation

@davidnguyen-tech
Copy link
Contributor

@davidnguyen-tech davidnguyen-tech commented Feb 23, 2026

Summary

Adds an autocomplete dropdown when typing / in the chat input (expanded view and card view).

Demo

image image

Features

  • Dropdown menu with all slash commands, sorted alphabetically, showing descriptions and parameter usage hints
  • Keyboard navigation — Arrow keys to browse, Enter/Tab to select, Escape to dismiss
  • Auto-send — parameterless commands (/help, /clear, etc.) send immediately on selection
  • Ghost text overlay — inline parameter hints in muted text (e.g., typing /mcp shows [show|add|edit|delete|disable|enable] [server-name] | reload)
  • Locked mode — dropdown stays visible while typing arguments for reference
  • Bottom-anchored positioning with viewport-aware flip

Files changed

  • PolyPilot/wwwroot/index.html — JS implementation (~297 lines)
  • PolyPilot/Components/SessionCard.razor — added .send-btn class for auto-send
  • PolyPilot.Tests/SlashCommandAutocompleteTests.cs — 22 tests cross-referencing JS commands against C# handler

Performance

  • rAF-debounced input handling
  • Cached DOM rebuilds (skip when options unchanged)
  • Per-element state to support multiple card inputs in grid view

davidnguyen-tech and others added 6 commits February 23, 2026 14:00
Show a filterable dropdown of available slash commands when the user types
'/' at the start of the chat input (both expanded textarea and card input).
Follows the existing Fiesta @-mention autocomplete pattern with keyboard
navigation (Arrow keys, Tab to select, Escape to dismiss). The dropdown
opens above the input and filters as the user types.

Add SlashCommandAutocompleteTests to verify the JS command list stays in
sync with the C# HandleSlashCommand handler and /help output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix arrow key scrolling (use manual scrollTop instead of scrollIntoView)
- Match font size to textarea (0.9rem)
- Enter key selects command (not just Tab)
- Auto-send parameterless commands on Enter
- Show parameter usage hints (e.g. /mcp [show|add|...])
- Add inline ghost text preview for commands with parameters
- Clear ghost text on send
- Sort commands alphabetically
- Performance: rAF debounce, DOM caching, skip redundant updates

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…utton

- Don't intercept Enter/Tab in locked mode (user typing args) — fixes
  /rename Foo losing arguments when pressing Enter
- Use per-element _lastSlashValue instead of global _lastValue — fixes
  autocomplete not appearing when two cards have the same input value
- Add send-btn class to SessionCard's send button — fixes auto-send
  for parameterless commands in card view
- Fix AutocompleteDropdown_OpensAboveInput test to scope to slash section
- Add 3 regression tests for the above issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…le dropdown

- chooseOption: find command boundary from full value, not cursor position
- getSlashContext: use full value for locked mode detection
- updateDropdownPosition: invalidate cache on textarea resize (offsetHeight)
- updateDropdownPosition: flip below when no space above, no 120px min
- Add focusout listener to hide dropdown on Tab-out
- hideDropdown clears focusout timer to prevent race condition
- Add box-sizing:border-box to dropdown for accurate maxHeight
- Cancel rAF in no-args auto-send to prevent stale dropdown reopen
- Dropdown mousedown preventDefault to keep focus during scrollbar use
- clearElementValue hides slash dropdown after sending commands
- /status changed to hasArgs:true (handler accepts args)
- Help text test now checks both directions (autocomplete ⊆ help AND help ⊆ autocomplete)
- 22 tests covering all review findings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidnguyen-tech davidnguyen-tech marked this pull request as ready for review February 23, 2026 15:18
@davidnguyen-tech davidnguyen-tech changed the title Add slash command autocomplete dropdown Feature: Add slash command autocomplete dropdown Feb 23, 2026
@PureWeen PureWeen merged commit 13409d0 into PureWeen:main Feb 23, 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