Skip to content

Commit

Permalink
Fix formatter with whitespace before closing parenthesis (#14471)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Apr 10, 2024
1 parent aee9ab6 commit 85525fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,21 @@ describe Crystal::Formatter do
); end
CRYSTAL

assert_format <<-CRYSTAL, <<-CRYSTAL
module M
@[MyAnn(
1

)]
end
CRYSTAL
module M
@[MyAnn(
1
)]
end
CRYSTAL

assert_format "loop do\n 1\nrescue\n 2\nend"
assert_format "loop do\n 1\n loop do\n 2\n rescue\n 3\n end\n 4\nend"

Expand Down
1 change: 1 addition & 0 deletions src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3031,6 +3031,7 @@ module Crystal
ends_with_newline = true
next_token
end
skip_space_or_newline
finish_args(true, has_newlines, ends_with_newline, found_comment, @indent)
end

Expand Down

0 comments on commit 85525fc

Please sign in to comment.