@codemirror/language 6.12.2 → 6.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.12.3 (2026-03-25)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a crash in `bracketMatching` when composing at end of document.
6
+
1
7
  ## 6.12.2 (2026-02-25)
2
8
 
3
9
  ### Bug fixes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @codemirror/language [![NPM version](https://img.shields.io/npm/v/@codemirror/language.svg)](https://www.npmjs.org/package/@codemirror/language)
2
2
 
3
- [ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#language) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/language/blob/main/CHANGELOG.md) ]
3
+ [ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#language) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/) | [**CHANGELOG**](https://github.com/codemirror/language/blob/main/CHANGELOG.md) ]
4
4
 
5
5
  This package implements the language support infrastructure for the
6
6
  [CodeMirror](https://codemirror.net/) code editor.
package/dist/index.cjs CHANGED
@@ -1983,6 +1983,8 @@ function matchMarkedBrackets(_state, _pos, dir, token, handle, matching, bracket
1983
1983
  return { start: firstToken, matched: false };
1984
1984
  }
1985
1985
  function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, brackets) {
1986
+ if (dir < 0 ? !pos : pos == state.doc.length)
1987
+ return null;
1986
1988
  let startCh = dir < 0 ? state.sliceDoc(pos - 1, pos) : state.sliceDoc(pos, pos + 1);
1987
1989
  let bracket = brackets.indexOf(startCh);
1988
1990
  if (bracket < 0 || (bracket % 2 == 0) != (dir > 0))
package/dist/index.js CHANGED
@@ -1981,6 +1981,8 @@ function matchMarkedBrackets(_state, _pos, dir, token, handle, matching, bracket
1981
1981
  return { start: firstToken, matched: false };
1982
1982
  }
1983
1983
  function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, brackets) {
1984
+ if (dir < 0 ? !pos : pos == state.doc.length)
1985
+ return null;
1984
1986
  let startCh = dir < 0 ? state.sliceDoc(pos - 1, pos) : state.sliceDoc(pos, pos + 1);
1985
1987
  let bracket = brackets.indexOf(startCh);
1986
1988
  if (bracket < 0 || (bracket % 2 == 0) != (dir > 0))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/language",
3
- "version": "6.12.2",
3
+ "version": "6.12.3",
4
4
  "description": "Language support infrastructure for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",