rufo icon indicating copy to clipboard operation
rufo copied to clipboard

Wrong indentation for literal array with interpolation at the beginning of a string

Open pmk1c opened this issue 6 years ago • 1 comments

RuFo 0.7.0 Ruby 2.4.6

RuFo is behaving weirdly on literal arrays with interpolation at the beginning of a string. See this for example:

test = %W[
  #{a}test
]

Running RuFo on it will format to:

test = %W[
    #{a}test
]

Running RuFo again will format to:

test = %W[
      #{a}test
]

The interpolation has to be at the beginning of the string.

test = %W[
  test
  #{a}test
  test#{a}
  test#{a}test
]

Will format to:

test = %W[
  test
    #{a}test
  test#{a}
  test#{a}test
]

pmk1c avatar Jun 18 '19 06:06 pmk1c

puts :foo, bar: {
  baz: :qux,
}

Also needs two runs to indent, which means rufo . && rufo --check will fail.

puts :foo, bar: {
        baz: :qux,
      }
puts :foo, bar: {
             baz: :qux,
           }

ssendev avatar Sep 12 '19 09:09 ssendev