Skip to content

Commit e3ccab2

Browse files
committed
Fix an issue in StreamLanguage indentation
FIX: Fix an issue where indentation for a stream language would fail to work when the parse covered only part of the document, far from the start. Closes codemirror/dev#1483
1 parent 17e4215 commit e3ccab2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/stream-parser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class StreamLanguage<State> extends Language {
115115
}
116116
let start = findState(this, cx.node.tree!, 0, cx.node.from, from ?? cx.pos), statePos, state
117117
if (start) { state = start.state; statePos = start.pos + 1 }
118-
else { state = this.streamParser.startState(cx.unit) ; statePos = 0 }
118+
else { state = this.streamParser.startState(cx.unit) ; statePos = cx.node.from }
119119
if (cx.pos - statePos > C.MaxIndentScanDist) return null
120120
while (statePos < cx.pos) {
121121
let line = cx.state.doc.lineAt(statePos), end = Math.min(cx.pos, line.to)

0 commit comments

Comments
 (0)