Add autocomplete for slash commands

This commit is contained in:
Seth Troisi
2025-05-01 00:52:01 +00:00
parent f237082c37
commit cc838fad44
4 changed files with 62 additions and 17 deletions

View File

@@ -16,6 +16,15 @@ export const isAtCommand = (query: string): boolean =>
// Check if starts with @ OR has a space, then @, then a non-space character.
query.startsWith('@') || /\s@\S/.test(query);
/**
* Checks if a query string potentially represents an '/' command.
* It triggers if the query starts with '/'
*
* @param query The input query string.
* @returns True if the query looks like an '/' command, false otherwise.
*/
export const isSlashCommand = (query: string): boolean => query.startsWith('/');
const control_symbols: string[] = ['/', '@', '!', '?', '$'];
/**
* Returns the first word of query with optional leading slash, ampersand, bang.