I’m using Latex autocompletion if I type { during the autocompletion matching process, the autocompletion will be interrupted by brackets auto-matching. The completion matching pane will disappear once the { inputted.
Looking for a way to enable brackets auto-matching, hope for your reply.
Is your problem that bracket closing interrupts completion, or are you asking how to enable bracket closing? (For the latter, see the closebrackets addon.)
I used override to create my own source. After using RegExp CodeMirror 6 Reference Manual, the interruption has been overcome.
However, it brings another issue: the bracket closing will cause the extra bracket on the editor. Cause my completion already have the {}.
Like this:
So I hope is there a way cm6 can offer to make brackets don’t auto-closing?
Below is my code:
autocompletion({
activateOnTyping: true,
override: [myCompletions], // myCompletions is the source name
}),
function myCompletions(CompletionContext) {
let word = CompletionContext.matchBefore(/\\\w*{*.*/); // Here's the RegExp
if (word.from == word.to && !CompletionContext.explicit) {
return null;
}
let options = [];
for (let i in dictionaryOne) { // dictionaryOne is where i put my completion words
options.push({
label: dictionaryOne[i].text,
label: dictionaryOne[i].snippet,
});
}
return {
from: word.from,
options,
};
}