Skip to content

Let extensions register autocomplete trigger characters #4703

@sndrgrdn

Description

@sndrgrdn

The editor only triggers autocomplete on /, @, and #. Extensions can add providers via addAutocompleteProvider, but there's no way to make the editor actually call them on a different character.

I hit this building an inline skill reference extension. $skill-name autocomplete. The provider works, but $ never fires it. Ended up using # instead, which works but could conflict with other extensions. The alternative is calling tryTriggerAutocomplete() through a runtime cast, which is fragile.

Could the editor or provider accept additional trigger characters?

// Either on the editor:
editor.addAutocompleteTrigger("$");

// Or on the provider:
interface AutocompleteProvider {
  triggerCharacters?: string[];
}

The trigger logic in insertCharacter would treat registered characters the same as @/#. Fire at token boundaries. The continuation regex ([@#][^\s]*$) would need to include them too.

Right now extensions can add autocomplete providers but can't actually trigger them. Three hardcoded characters isn't really extensible.

Metadata

Metadata

Assignees

Labels

inprogressIssue is being worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions