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
50
50
- Allow flip-flop operators to be formatted correctly within ` IfMod ` and ` UnlessMod ` nodes.
51
51
- Allow ` IfMod ` and ` UnlessMod ` to know about heredocs moving their bounds.
52
52
- Properly handle breaking parameters when there are no parentheses.
53
+ - Properly handle trailing operators in call chains with attached comments.
53
54
54
55
### Removed
55
56
Original file line number Diff line number Diff line change @@ -3093,12 +3093,19 @@ def child_nodes
3093
3093
end
3094
3094
3095
3095
def format ( q )
3096
+ call_operator = CallOperatorFormatter . new ( operator )
3097
+
3096
3098
q . group do
3097
3099
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
+
3098
3105
q . group do
3099
3106
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?
3102
3109
q . format ( message ) if message != :call
3103
3110
q . format ( arguments ) if arguments
3104
3111
end
You can’t perform that action at this time.
0 commit comments