File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -3052,8 +3052,20 @@ def format(q)
30523052 doc =
30533053 q . nest ( 0 ) do
30543054 q . format ( receiver )
3055- q . format ( CallOperatorFormatter . new ( operator ) , stackable : false )
3056- q . format ( message )
3055+
3056+ # If there are leading comments on the message then we know we have
3057+ # a newline in the source that is forcing these things apart. In
3058+ # this case we will have to use a trailing operator.
3059+ if message . comments . any? ( &:leading? )
3060+ q . format ( CallOperatorFormatter . new ( operator ) , stackable : false )
3061+ q . indent do
3062+ q . breakable ( "" )
3063+ q . format ( message )
3064+ end
3065+ else
3066+ q . format ( CallOperatorFormatter . new ( operator ) , stackable : false )
3067+ q . format ( message )
3068+ end
30573069 end
30583070
30593071 case arguments
Original file line number Diff line number Diff line change 2828%
2929foo.bar baz do
3030end
31+ %
32+ foo.
33+ # comment
34+ bar baz
You can’t perform that action at this time.
0 commit comments