If I have implemented a basic completion function like so:
function myCompletions(context: CompletionContext) {
let word = context.matchBefore(/\w*/);
if (word?.from == word?.to && !context.explicit) return null;
return {
from: word?.from,
options: [
{ label: "match", type: "keyword" },
{ label: "hello", type: "variable", info: "(World)" },
{ label: "magic", type: "text", apply: "⠁⭒*.✩.*⭒⠁", detail: "macro" },
],
};
}
The autocomplete example says I should then add this to a language with
myLanguage.data.of({
autocomplete: myCompletions
})
But as far as I can tell this means defining a parser for that language which I would rather not do. I’ve tried turning it into an extension with:
const autocompleteExt = Facet.define().of({
autocomplete: myCompletions,
});
Which type checks, but doesn’t seem to work. Is there a way of doing this that does work?