How to enable the brackets auto-matching?


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.)

Hi marijn!

My problem is the bracket closing interrupts completion, could you please give some advice?

PS: used the CM6 for the auto conpletion.

How does your completion source work? At a glance, even when brackets are auto-closed, they should trigger completion.

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:

                activateOnTyping: true,
                override: [myCompletions],  // myCompletions is the source name
function myCompletions(CompletionContext) {

  let word = CompletionContext.matchBefore(/\\\w*{*.*/);  // Here's the RegExp 

  if (word.from == && !CompletionContext.explicit) {

    return null;


  let options = [];

  for (let i in dictionaryOne) { // dictionaryOne is where i put my completion words


      label: dictionaryOne[i].text,

      label: dictionaryOne[i].snippet,



  return {

    from: word.from,




Don’t include the closeBrackets extension (which is part of basicSetup).

Oh ok, I’ll try this! Thanks a lot for your time.