Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions spec/compiler/formatter/formatter_spec.cr
Original file line number Diff line number Diff line change
@@ -907,4 +907,6 @@ describe Crystal::Formatter do
assert_format "foo { | a, ( b , c ) | a + b + c }", "foo { |a, (b, c)| a + b + c }"
assert_format "foo { | a, ( b , c, ), | a + b + c }", "foo { |a, (b, c)| a + b + c }"
assert_format "foo { | a, ( _ , c ) | a + c }", "foo { |a, (_, c)| a + c }"

assert_format "def foo\n {{@type}}\nend"
end
6 changes: 5 additions & 1 deletion src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
@@ -1202,7 +1202,11 @@ module Crystal
@inside_def += 1

write_keyword :abstract, " " if node.abstract?
write_keyword :macro, " " if node.macro_def?

if node.macro_def? && @token.keyword?(:macro)
write_keyword :macro, " "
end

write_keyword :def, " ", skip_space_or_newline: false

if receiver = node.receiver

0 comments on commit 3d13b18

Please sign in to comment.