@codemirror/language 6.10.0 → 6.10.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,9 @@
1
+ ## 6.10.1 (2024-02-02)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix an issue where, when a lot of code is visible in the initial editor, the bottom bit of code is shown without highlighting for one frame.
6
+
1
7
  ## 6.10.0 (2023-12-28)
2
8
 
3
9
  ### New features
package/dist/index.cjs CHANGED
@@ -1751,16 +1751,20 @@ class TreeHighlighter {
1751
1751
  this.markCache = Object.create(null);
1752
1752
  this.tree = syntaxTree(view.state);
1753
1753
  this.decorations = this.buildDeco(view, getHighlighters(view.state));
1754
+ this.decoratedTo = view.viewport.to;
1754
1755
  }
1755
1756
  update(update) {
1756
1757
  let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state);
1757
1758
  let styleChange = highlighters != getHighlighters(update.startState);
1758
- if (tree.length < update.view.viewport.to && !styleChange && tree.type == this.tree.type) {
1759
+ let { viewport } = update.view, decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1);
1760
+ if (tree.length < viewport.to && !styleChange && tree.type == this.tree.type && decoratedToMapped >= viewport.to) {
1759
1761
  this.decorations = this.decorations.map(update.changes);
1762
+ this.decoratedTo = decoratedToMapped;
1760
1763
  }
1761
1764
  else if (tree != this.tree || update.viewportChanged || styleChange) {
1762
1765
  this.tree = tree;
1763
1766
  this.decorations = this.buildDeco(update.view, highlighters);
1767
+ this.decoratedTo = viewport.to;
1764
1768
  }
1765
1769
  }
1766
1770
  buildDeco(view$1, highlighters) {
@@ -2568,7 +2572,7 @@ const isolateMarks = view.ViewPlugin.fromClass(class {
2568
2572
  view$1.state.facet(view.EditorView.perLineTextDirection);
2569
2573
  this.hasRTL = !this.always && textHasRTL(view$1.state.doc);
2570
2574
  this.tree = syntaxTree(view$1.state);
2571
- this.decorations = buildDeco(view$1, this.tree, this.always);
2575
+ this.decorations = this.always || this.hasRTL ? buildDeco(view$1, this.tree, this.always) : view.Decoration.none;
2572
2576
  }
2573
2577
  update(update) {
2574
2578
  let always = update.state.facet(alwaysIsolate) ||
package/dist/index.js CHANGED
@@ -1749,16 +1749,20 @@ class TreeHighlighter {
1749
1749
  this.markCache = Object.create(null);
1750
1750
  this.tree = syntaxTree(view.state);
1751
1751
  this.decorations = this.buildDeco(view, getHighlighters(view.state));
1752
+ this.decoratedTo = view.viewport.to;
1752
1753
  }
1753
1754
  update(update) {
1754
1755
  let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state);
1755
1756
  let styleChange = highlighters != getHighlighters(update.startState);
1756
- if (tree.length < update.view.viewport.to && !styleChange && tree.type == this.tree.type) {
1757
+ let { viewport } = update.view, decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1);
1758
+ if (tree.length < viewport.to && !styleChange && tree.type == this.tree.type && decoratedToMapped >= viewport.to) {
1757
1759
  this.decorations = this.decorations.map(update.changes);
1760
+ this.decoratedTo = decoratedToMapped;
1758
1761
  }
1759
1762
  else if (tree != this.tree || update.viewportChanged || styleChange) {
1760
1763
  this.tree = tree;
1761
1764
  this.decorations = this.buildDeco(update.view, highlighters);
1765
+ this.decoratedTo = viewport.to;
1762
1766
  }
1763
1767
  }
1764
1768
  buildDeco(view, highlighters) {
@@ -2566,7 +2570,7 @@ const isolateMarks = /*@__PURE__*/ViewPlugin.fromClass(class {
2566
2570
  view.state.facet(EditorView.perLineTextDirection);
2567
2571
  this.hasRTL = !this.always && textHasRTL(view.state.doc);
2568
2572
  this.tree = syntaxTree(view.state);
2569
- this.decorations = buildDeco(view, this.tree, this.always);
2573
+ this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : Decoration.none;
2570
2574
  }
2571
2575
  update(update) {
2572
2576
  let always = update.state.facet(alwaysIsolate) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/language",
3
- "version": "6.10.0",
3
+ "version": "6.10.1",
4
4
  "description": "Language support infrastructure for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",