Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 74655bb

Browse files
committed
Ensure comments on assignment after the = before the value keep their place.
1 parent b8161a2 commit 74655bb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1515
- Allow `Hash` opening braces to have trailing comments.
1616
- Add parentheses if `Yield` breaks onto multiple lines.
1717
- Ensure all nodes that could have heredocs nested know about their end lines.
18+
- Ensure comments on assignment after the `=` before the value keep their place.
1819

1920
### Changed
2021

lib/syntax_tree.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ def format(q)
16961696
q.format(target)
16971697
q.text(" =")
16981698

1699-
if skip_indent_target? || skip_indent_value?
1699+
if target.comments.empty? && (skip_indent_target? || skip_indent_value?)
17001700
q.text(" ")
17011701
q.format(value)
17021702
else

0 commit comments

Comments
 (0)