slash command altnames and support for ?

This commit is contained in:
Seth Troisi
2025-05-05 21:16:13 +00:00
parent bb52149a06
commit 2cd976987e
2 changed files with 19 additions and 23 deletions

View File

@@ -119,9 +119,18 @@ export function useCompletion(
// --- Handle Slash Command Completion ---
if (trimmedQuery.startsWith('/')) {
const partialCommand = trimmedQuery.substring(1);
const filteredSuggestions = slashCommands
const commands = slashCommands
.map((cmd) => cmd.name)
.concat(
slashCommands
.map((cmd) => cmd.altName)
.filter((cmd) => cmd !== undefined),
);
const filteredSuggestions = commands
.filter((name) => name.startsWith(partialCommand))
// Filter out ? and any other single character commands
.filter((name) => name.length > 1)
.map((name) => ({ label: name, value: name }))
.sort();