With this code I get a list of options for all keywords but it doesn’t filter them based in input.
const keywords = ['*:', '**:', '#:', '##:', 'backdrop:', 'blank:', 'box:', 'form:', 'filter:', 'image:', 'line:', 'link:', 'paragraph:', 'read:', 'stackName:', 'subtitle:', 'supertitle:', 'tap:', 'title:', 'video:']
export function myCompletions(context: CompletionContext) {
const startOfLine = context.matchBefore(new RegExp("^.*"));
if (!startOfLine) return null;
let options: { label: string; boost?: number }[] = [];
if (startOfLine) {
options = keywords.map(keyword => {
return {
label: keyword,
};
});
}
const completion = {
from: context.pos,
options,
};
return completion;
}