@codemirror/language 0.19.6 → 0.19.7
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 +6 -0
- package/dist/index.cjs +3 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -179,7 +179,7 @@ up to that point if the tree isn't already available.
|
|
|
179
179
|
function ensureSyntaxTree(state, upto, timeout = 50) {
|
|
180
180
|
var _a;
|
|
181
181
|
let parse = (_a = state.field(Language.state, false)) === null || _a === void 0 ? void 0 : _a.context;
|
|
182
|
-
return !parse ? null : parse.
|
|
182
|
+
return !parse ? null : parse.isDone(upto) || parse.work(timeout, upto) ? parse.tree : null;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
Queries whether there is a full syntax tree available up to the
|
|
@@ -452,6 +452,7 @@ class ParseContext {
|
|
|
452
452
|
@internal
|
|
453
453
|
*/
|
|
454
454
|
isDone(upto) {
|
|
455
|
+
upto = Math.min(upto, this.state.doc.length);
|
|
455
456
|
let frags = this.fragments;
|
|
456
457
|
return this.treeLen >= upto && frags.length && frags[0].from == 0 && frags[0].to >= upto;
|
|
457
458
|
}
|
|
@@ -555,7 +556,7 @@ const parseWorker = view.ViewPlugin.fromClass(class ParseWorker {
|
|
|
555
556
|
if (this.chunkBudget <= 0)
|
|
556
557
|
return; // No more budget
|
|
557
558
|
let { state, viewport: { to: vpTo } } = this.view, field = state.field(Language.state);
|
|
558
|
-
if (field.tree == field.context.tree && field.context.
|
|
559
|
+
if (field.tree == field.context.tree && field.context.isDone(vpTo + 100000 /* MaxParseAhead */))
|
|
559
560
|
return;
|
|
560
561
|
let time = Math.min(this.chunkBudget, 100 /* Slice */, deadline ? Math.max(25 /* MinSlice */, deadline.timeRemaining() - 5) : 1e9);
|
|
561
562
|
let viewportFirst = field.context.treeLen < vpTo && state.doc.length > vpTo + 1000;
|
package/dist/index.js
CHANGED
|
@@ -175,7 +175,7 @@ up to that point if the tree isn't already available.
|
|
|
175
175
|
function ensureSyntaxTree(state, upto, timeout = 50) {
|
|
176
176
|
var _a;
|
|
177
177
|
let parse = (_a = state.field(Language.state, false)) === null || _a === void 0 ? void 0 : _a.context;
|
|
178
|
-
return !parse ? null : parse.
|
|
178
|
+
return !parse ? null : parse.isDone(upto) || parse.work(timeout, upto) ? parse.tree : null;
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
Queries whether there is a full syntax tree available up to the
|
|
@@ -448,6 +448,7 @@ class ParseContext {
|
|
|
448
448
|
@internal
|
|
449
449
|
*/
|
|
450
450
|
isDone(upto) {
|
|
451
|
+
upto = Math.min(upto, this.state.doc.length);
|
|
451
452
|
let frags = this.fragments;
|
|
452
453
|
return this.treeLen >= upto && frags.length && frags[0].from == 0 && frags[0].to >= upto;
|
|
453
454
|
}
|
|
@@ -551,7 +552,7 @@ const parseWorker = /*@__PURE__*/ViewPlugin.fromClass(class ParseWorker {
|
|
|
551
552
|
if (this.chunkBudget <= 0)
|
|
552
553
|
return; // No more budget
|
|
553
554
|
let { state, viewport: { to: vpTo } } = this.view, field = state.field(Language.state);
|
|
554
|
-
if (field.tree == field.context.tree && field.context.
|
|
555
|
+
if (field.tree == field.context.tree && field.context.isDone(vpTo + 100000 /* MaxParseAhead */))
|
|
555
556
|
return;
|
|
556
557
|
let time = Math.min(this.chunkBudget, 100 /* Slice */, deadline ? Math.max(25 /* MinSlice */, deadline.timeRemaining() - 5) : 1e9);
|
|
557
558
|
let viewportFirst = field.context.treeLen < vpTo && state.doc.length > vpTo + 1000;
|