File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
5050- Allow flip-flop operators to be formatted correctly within ` IfMod ` and ` UnlessMod ` nodes.
5151- Allow ` IfMod ` and ` UnlessMod ` to know about heredocs moving their bounds.
5252- Properly handle breaking parameters when there are no parentheses.
53+ - Properly handle trailing operators in call chains with attached comments.
5354
5455### Removed
5556
Original file line number Diff line number Diff line change @@ -3093,12 +3093,19 @@ def child_nodes
30933093 end
30943094
30953095 def format ( q )
3096+ call_operator = CallOperatorFormatter . new ( operator )
3097+
30963098 q . group do
30973099 q . format ( receiver )
3100+
3101+ # If there are trailing comments on the call operator, then we need to
3102+ # use the trailing form as opposed to the leading form.
3103+ q . format ( call_operator ) if call_operator . comments . any?
3104+
30983105 q . group do
30993106 q . indent do
3100- q . breakable ( force : true ) if receiver . comments . any?
3101- q . format ( CallOperatorFormatter . new ( operator ) )
3107+ q . breakable ( force : true ) if receiver . comments . any? || call_operator . comments . any?
3108+ q . format ( call_operator ) if call_operator . comments . empty?
31023109 q . format ( message ) if message != :call
31033110 q . format ( arguments ) if arguments
31043111 end
You can’t perform that action at this time.
0 commit comments