detectAutocomplete

Detects whether an active autocompletion trigger pattern is present immediately before the cursor.

Scans backwards from cursorPosition within the current line to find the nearest trigger defined in triggers.

Return

An AutocompleteMatch if a trigger pattern is actively matched, or null otherwise.

Parameters

text

The full text content.

cursorPosition

The current cursor index.

triggers

The list of autocomplete triggers to evaluate.