@@ -662,7 +662,13 @@ pub fn treesitter_indent_for_pos(
662 node = parent;
662 node = parent;
663 first_in_line.pop();
663 first_in_line.pop();
665+ // Only add the indentation for the line below if that line
666+ // is not after the line that the indentation is calculated for.
667+ if (node.start_position().row < line)
668+ || (new_line && node.start_position().row == line && node.start_byte() < byte_pos)
665− result.add_line(&indent_for_line_below);
670+ result.add_line(&indent_for_line_below);
666 result.add_line(&indent_for_line);
672 result.add_line(&indent_for_line);