@codemirror/language 6.10.4 → 6.10.6
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 +12 -0
- package/dist/index.cjs +4 -3
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 6.10.6 (2024-11-29)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix a crash in `StreamLanguage` when the input range is entirely before the editor viewport.
|
|
6
|
+
|
|
7
|
+
## 6.10.5 (2024-11-27)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Fix an issue where a `StreamLanguage` could get confused when trying to reuse existing parse data when the parsed range changed.
|
|
12
|
+
|
|
1
13
|
## 6.10.4 (2024-11-24)
|
|
2
14
|
|
|
3
15
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -2278,7 +2278,7 @@ function findState(lang, tree, off, startPos, before) {
|
|
|
2278
2278
|
function cutTree(lang, tree, from, to, inside) {
|
|
2279
2279
|
if (inside && from <= 0 && to >= tree.length)
|
|
2280
2280
|
return tree;
|
|
2281
|
-
if (!inside && tree.type == lang.topNode)
|
|
2281
|
+
if (!inside && from == 0 && tree.type == lang.topNode)
|
|
2282
2282
|
inside = true;
|
|
2283
2283
|
for (let i = tree.children.length - 1; i >= 0; i--) {
|
|
2284
2284
|
let pos = tree.positions[i], child = tree.children[i], inner;
|
|
@@ -2314,14 +2314,15 @@ class Parse {
|
|
|
2314
2314
|
this.rangeIndex = 0;
|
|
2315
2315
|
this.to = ranges[ranges.length - 1].to;
|
|
2316
2316
|
let context = ParseContext.get(), from = ranges[0].from;
|
|
2317
|
-
let { state, tree } = findStartInFragments(lang, fragments, from,
|
|
2317
|
+
let { state, tree } = findStartInFragments(lang, fragments, from, this.to, context === null || context === void 0 ? void 0 : context.state);
|
|
2318
2318
|
this.state = state;
|
|
2319
2319
|
this.parsedPos = this.chunkStart = from + tree.length;
|
|
2320
2320
|
for (let i = 0; i < tree.children.length; i++) {
|
|
2321
2321
|
this.chunks.push(tree.children[i]);
|
|
2322
2322
|
this.chunkPos.push(tree.positions[i]);
|
|
2323
2323
|
}
|
|
2324
|
-
if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */
|
|
2324
|
+
if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */ &&
|
|
2325
|
+
ranges.some(r => r.from <= context.viewport.from && r.to >= context.viewport.from)) {
|
|
2325
2326
|
this.state = this.lang.streamParser.startState(getIndentUnit(context.state));
|
|
2326
2327
|
context.skipUntilInView(this.parsedPos, context.viewport.from);
|
|
2327
2328
|
this.parsedPos = context.viewport.from;
|
package/dist/index.js
CHANGED
|
@@ -2276,7 +2276,7 @@ function findState(lang, tree, off, startPos, before) {
|
|
|
2276
2276
|
function cutTree(lang, tree, from, to, inside) {
|
|
2277
2277
|
if (inside && from <= 0 && to >= tree.length)
|
|
2278
2278
|
return tree;
|
|
2279
|
-
if (!inside && tree.type == lang.topNode)
|
|
2279
|
+
if (!inside && from == 0 && tree.type == lang.topNode)
|
|
2280
2280
|
inside = true;
|
|
2281
2281
|
for (let i = tree.children.length - 1; i >= 0; i--) {
|
|
2282
2282
|
let pos = tree.positions[i], child = tree.children[i], inner;
|
|
@@ -2312,14 +2312,15 @@ class Parse {
|
|
|
2312
2312
|
this.rangeIndex = 0;
|
|
2313
2313
|
this.to = ranges[ranges.length - 1].to;
|
|
2314
2314
|
let context = ParseContext.get(), from = ranges[0].from;
|
|
2315
|
-
let { state, tree } = findStartInFragments(lang, fragments, from,
|
|
2315
|
+
let { state, tree } = findStartInFragments(lang, fragments, from, this.to, context === null || context === void 0 ? void 0 : context.state);
|
|
2316
2316
|
this.state = state;
|
|
2317
2317
|
this.parsedPos = this.chunkStart = from + tree.length;
|
|
2318
2318
|
for (let i = 0; i < tree.children.length; i++) {
|
|
2319
2319
|
this.chunks.push(tree.children[i]);
|
|
2320
2320
|
this.chunkPos.push(tree.positions[i]);
|
|
2321
2321
|
}
|
|
2322
|
-
if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */
|
|
2322
|
+
if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */ &&
|
|
2323
|
+
ranges.some(r => r.from <= context.viewport.from && r.to >= context.viewport.from)) {
|
|
2323
2324
|
this.state = this.lang.streamParser.startState(getIndentUnit(context.state));
|
|
2324
2325
|
context.skipUntilInView(this.parsedPos, context.viewport.from);
|
|
2325
2326
|
this.parsedPos = context.viewport.from;
|