prettier-ruby
prettier-ruby copied to clipboard
String/Symbol arrays not correctly formatted when indentation present
Raising this is as a separate issue to keep track of it:
https://github.com/iamsolankiamit/prettier-ruby/pull/4#discussion_r192064062
Input
def symbols
%i(
a
b
c
d
)
end
symbols
Current output
def symbols
[' a', ' b', ' c', ' d']
end
symbols
Expected Output
- Output should equal input still
- Or, formated with array syntax with without the extra whitespace
Some concrete expected outputs:
Strings
Either convert to array and ensure whitespace isn't present:
def strings
['a', 'b', 'c', 'd']
end
strings
Or output the same %w( ... ) syntax:
def strings
%w( a b c d )
end
strings
Symbols
Potential symbols output:
def symbols
[:a, :b, :c, :d]
end
symbols
Or:
def symbols
%i( a b c d )
end
symbols
Note:: that prettier-ruby is actually converting symbols to strings incorrectly with the current implementation too, which I didn't notice originally
right now if it is a symbol or string array we print it properly. we can consider converting [:a, :b] into %i[a b].