Skip to content

Commit

Permalink
Improve behavior of syntax indentation on language boundaries
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marijnh committed Dec 17, 2024
1 parent 28e0989 commit 8b28e31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/indent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const indentNodeProp = new NodeProp<(context: TreeIndentContext) => numbe
// Compute the indentation for a given position from the syntax tree.
function syntaxIndentation(cx: IndentContext, ast: Tree, pos: number) {
let stack = ast.resolveStack(pos)
let inner = stack.node.enterUnfinishedNodesBefore(pos)
let inner = ast.resolveInner(pos, -1).resolve(pos, 0).enterUnfinishedNodesBefore(pos)
if (inner != stack.node) {
let add = []
for (let cur = inner; cur != stack.node; cur = cur.parent!) add.push(cur)
Expand Down

0 comments on commit 8b28e31

Please sign in to comment.