Skip to content

Commit 85525fc

Browse files
Fix formatter with whitespace before closing parenthesis (#14471)
1 parent aee9ab6 commit 85525fc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

spec/compiler/formatter/formatter_spec.cr

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,21 @@ describe Crystal::Formatter do
437437
); end
438438
CRYSTAL
439439

440+
assert_format <<-CRYSTAL, <<-CRYSTAL
441+
module M
442+
@[MyAnn(
443+
1
444+
445+
)]
446+
end
447+
CRYSTAL
448+
module M
449+
@[MyAnn(
450+
1
451+
)]
452+
end
453+
CRYSTAL
454+
440455
assert_format "loop do\n 1\nrescue\n 2\nend"
441456
assert_format "loop do\n 1\n loop do\n 2\n rescue\n 3\n end\n 4\nend"
442457

src/compiler/crystal/tools/formatter.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,7 @@ module Crystal
30313031
ends_with_newline = true
30323032
next_token
30333033
end
3034+
skip_space_or_newline
30343035
finish_args(true, has_newlines, ends_with_newline, found_comment, @indent)
30353036
end
30363037

0 commit comments

Comments
 (0)