closeBrackets

fun closeBrackets(config: CloseBracketsConfig = CloseBracketsConfig()): Extension

Extension that auto-closes brackets and quotes, following upstream @codemirror/autocomplete's closeBrackets:

  • Typing an opening bracket inserts its closing bracket after each cursor when the next character is whitespace, one of CloseBracketsConfig.before, or the end of the document, and wraps each non-empty selection.

  • Typing a closing bracket directly in front of one the extension inserted moves over it.

  • A quote is closed only where a string can start (not after a word character) and the cursor is not already inside a string.