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.
The editor only triggers autocomplete on
/,@, and#. Extensions can add providers viaaddAutocompleteProvider, 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-nameautocomplete. The provider works, but$never fires it. Ended up using#instead, which works but could conflict with other extensions. The alternative is callingtryTriggerAutocomplete()through a runtime cast, which is fragile.Could the editor or provider accept additional trigger characters?
The trigger logic in
insertCharacterwould 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.