Skip to content

Commit

Permalink
Formatter: properly indent comments at the end of a proc literal (#8778)
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Feb 10, 2020
1 parent fc9e15c commit 39ce85d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1602,4 +1602,12 @@ describe Crystal::Formatter do
CODE

assert_format "a.!"

assert_format <<-CODE
->{
# first comment
puts "hi"
# second comment
}
CODE
end
4 changes: 3 additions & 1 deletion src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4060,7 +4060,9 @@ module Crystal
end
end

skip_space_or_newline
indent do
skip_space_or_newline
end

if is_do
check_end
Expand Down

0 comments on commit 39ce85d

Please sign in to comment.