Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This file documents the changes made to the formatter with each release.
- Fixed an extra comma being inserted after a trailing comment in a lambda function argument (#304)
- fixed certain export annotations being moved out of their respective groups (#308)
- Preserve up to one blank line used to group elements in "containers" like enums
- Fixed losing blank line between statements in a body if the previous statement has an inline comment (#320, thanks @Buitragox for the fix)

## Release 0.24.0 (2026-07-25)

Expand Down
2 changes: 1 addition & 1 deletion src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ fn process_body(
false,
);
}
} else if statement_has_inline_comment && current_is_declaration {
} else if statement_has_inline_comment {
let needs_two_blank_lines = needs_two_blank_lines(current_child_kind);
add_spacing_between_body_children(
previous_end,
Expand Down
17 changes: 17 additions & 0 deletions tests/expected/comment_edge_cases.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ func test3():

else:
pass


func test_inline_comment_preserves_blank_line():
some_call() # inline comment

another_call()


func test_inline_comment_no_blank_line():
some_call() # inline comment
another_call()


func test_inline_comment_multiple_blank_lines_collapse():
some_call() # inline comment

another_call()
17 changes: 17 additions & 0 deletions tests/input/comment_edge_cases.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ func test3():

else:
pass

func test_inline_comment_preserves_blank_line():
some_call() # inline comment

another_call()


func test_inline_comment_no_blank_line():
some_call() # inline comment
another_call()


func test_inline_comment_multiple_blank_lines_collapse():
some_call() # inline comment


another_call()