Skip to content

Commit

Permalink
Fix a bug that prevented predicate-overlay parses to be run in a stop…
Browse files Browse the repository at this point in the history
…ped parser

FIX: Fix a bug in mixed-language parsing that could some parts of an inner language
to be missed when incrementally reparsing from a stopped parse.

See https://discuss.codemirror.net/t/some-overlays-not-highlighted/7302
  • Loading branch information
marijnh committed Nov 8, 2023
1 parent 234bf0c commit 75cf5c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ class MixedParse implements PartialParse {
let covered: CoverInfo = null
let cursor = new TreeCursor(new TreeNode(this.baseTree!, this.ranges[0].from, 0, null),
IterMode.IncludeAnonymous | IterMode.IgnoreMounts)
scan: for (let nest, isCovered; this.stoppedAt == null || cursor.from < this.stoppedAt;) {
scan: for (let nest, isCovered;;) {
let enter = true, range
if (fragmentCursor.hasNode(cursor)) {
if (this.stoppedAt != null && cursor.from >= this.stoppedAt) {
enter = false
} else if (fragmentCursor.hasNode(cursor)) {
if (overlay) {
let match = overlay.mounts.find(m => m.frag.from <= cursor.from && m.frag.to >= cursor.to && m.mount.overlay)
if (match) for (let r of match.mount.overlay!) {
Expand Down

0 comments on commit 75cf5c6

Please sign in to comment.