@codemirror/language 6.2.0 → 6.2.1

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,11 @@
1
+ ## 6.2.1 (2022-07-21)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug where `bracketMatching` would incorrectly match nested brackets in syntax trees that put multiple pairs of brackets in the same parent node.
6
+
7
+ Fix a bug that could cause `indentRange` to loop infinitely.
8
+
1
9
  ## 6.2.0 (2022-06-30)
2
10
 
3
11
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -827,6 +827,7 @@ function indentRange(state, from, to) {
827
827
  let changes = [];
828
828
  for (let pos = from; pos <= to;) {
829
829
  let line = state.doc.lineAt(pos);
830
+ pos = line.to + 1;
830
831
  let indent = getIndentation(context, line.from);
831
832
  if (indent == null)
832
833
  continue;
@@ -838,7 +839,6 @@ function indentRange(state, from, to) {
838
839
  updated[line.from] = indent;
839
840
  changes.push({ from: line.from, to: line.from + cur.length, insert: norm });
840
841
  }
841
- pos = line.to + 1;
842
842
  }
843
843
  return state.changes(changes);
844
844
  }
@@ -1798,13 +1798,13 @@ function matchMarkedBrackets(_state, _pos, dir, token, matching, brackets) {
1798
1798
  depth++;
1799
1799
  }
1800
1800
  else if (matchingNodes(cursor.type, -dir, brackets)) {
1801
- depth--;
1802
1801
  if (depth == 0)
1803
1802
  return {
1804
1803
  start: firstToken,
1805
1804
  end: cursor.from == cursor.to ? undefined : { from: cursor.from, to: cursor.to },
1806
1805
  matched: false
1807
1806
  };
1807
+ depth--;
1808
1808
  }
1809
1809
  }
1810
1810
  } while (dir < 0 ? cursor.prevSibling() : cursor.nextSibling());
package/dist/index.js CHANGED
@@ -823,6 +823,7 @@ function indentRange(state, from, to) {
823
823
  let changes = [];
824
824
  for (let pos = from; pos <= to;) {
825
825
  let line = state.doc.lineAt(pos);
826
+ pos = line.to + 1;
826
827
  let indent = getIndentation(context, line.from);
827
828
  if (indent == null)
828
829
  continue;
@@ -834,7 +835,6 @@ function indentRange(state, from, to) {
834
835
  updated[line.from] = indent;
835
836
  changes.push({ from: line.from, to: line.from + cur.length, insert: norm });
836
837
  }
837
- pos = line.to + 1;
838
838
  }
839
839
  return state.changes(changes);
840
840
  }
@@ -1794,13 +1794,13 @@ function matchMarkedBrackets(_state, _pos, dir, token, matching, brackets) {
1794
1794
  depth++;
1795
1795
  }
1796
1796
  else if (matchingNodes(cursor.type, -dir, brackets)) {
1797
- depth--;
1798
1797
  if (depth == 0)
1799
1798
  return {
1800
1799
  start: firstToken,
1801
1800
  end: cursor.from == cursor.to ? undefined : { from: cursor.from, to: cursor.to },
1802
1801
  matched: false
1803
1802
  };
1803
+ depth--;
1804
1804
  }
1805
1805
  }
1806
1806
  } while (dir < 0 ? cursor.prevSibling() : cursor.nextSibling());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/language",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "Language support infrastructure for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",