Skip to content

Commit 8b28e31

Browse files
committed
Improve behavior of syntax indentation on language boundaries
FIX: Make sure the inner mode gets a chance to indent when indenting right at the end of a nested language section. See https://discuss.codemirror.net/t/python-fencedcode-indentation-inconsistent/8909
1 parent 28e0989 commit 8b28e31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/indent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export const indentNodeProp = new NodeProp<(context: TreeIndentContext) => numbe
196196
// Compute the indentation for a given position from the syntax tree.
197197
function syntaxIndentation(cx: IndentContext, ast: Tree, pos: number) {
198198
let stack = ast.resolveStack(pos)
199-
let inner = stack.node.enterUnfinishedNodesBefore(pos)
199+
let inner = ast.resolveInner(pos, -1).resolve(pos, 0).enterUnfinishedNodesBefore(pos)
200200
if (inner != stack.node) {
201201
let add = []
202202
for (let cur = inner; cur != stack.node; cur = cur.parent!) add.push(cur)

0 commit comments

Comments
 (0)