Hello, I am using following code which shows my custom completions after language keywords.
Is there a way I can see my custom completions before language keywords?
const customCompletions = [
{ label: "Apple", type: "variable" },
{ label: "Banana", type: "variable" },
{ label: "Watermelon", type: "variable" }
];
myCompletions(context) {
let word = context.matchBefore(/\w*/);
if (word.from == word.to && !context.explicit)
return null;
return {
from: word.from,
options: customCompletions
};
};
const myNewCompletions = language.data.of({
autocomplete: this.myCompletions
});
this.view = new EditorView({
doc: this.props.value,
extensions: [
keymap.of([{ key: "Enter", run: insertNewline }, indentWithTab, defaultKeymap]),
myNewCompletions,
basicSetup,
this.events(),
language
],
parent: this.editorRef.current
});
I want to see Banana, break
in the completion list -