SlashCommandProvider
Slash-command autocomplete provider. Triggers when the cursor follows a `/` that is either at the start of the text or follows whitespace — so `/` inside a file path (`./foo/bar`) does NOT trigger command completion. Suggestions are filtered and ranked via {@see FuzzyMatcher::filter()} so typing `/h` ranks `help` and `history` near the top. The provider is pure-in-memory: the caller hands the command table at construction time and the provider never touches the filesystem.
SlashCommandProvider::__construct()
public function __construct(array $commands):Parameters
| Name | Type | Description |
|---|---|---|
| $commands | array<int, array{name: string, description?: string}> |
SlashCommandProvider::shouldTrigger()
public function shouldTrigger(string $text, int $cursor): boolWhether the text at the cursor begins a slash command.
Parameters
| Name | Type | Description |
|---|---|---|
| $text | string | |
| $cursor | int |
SlashCommandProvider::suggestions()
public function suggestions(string $text, int $cursor): arrayThe commands matching what has been typed after the slash.
Parameters
| Name | Type | Description |
|---|---|---|
| $text | string | |
| $cursor | int |