New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatter: names tuple bug #3915
Comments
The extra spaces is because of a buggy implementation while trying to align labels and the indentation. What will be better? a) x = {bbbbbbb: 10,
aaaaaa: 20}
x = {haha: 10,
a: 20}
x = {a: 10,
bbbbb: 20} b) x = {bbbbbbb: 10,
aaaaaa: 20}
x = {haha: 10,
a: 20}
x = { a: 10,
bbbbb: 20} other? |
when it newlined it formatted like this: x = {
a: 10,
bbbbb: 20,
} so may be add auto newline, or a) |
a is most consistent with what the formatter already does |
Let's go with option a) then. |
This also happens with:
In case someone wants to have fun with it, the fix will probably be in https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/tools/formatter.cr#L682 and the spec around |
When the collection literal doesn't begin with a newline, contents are now aligned at the same column as the starting token, so this: x = { foo: 1, bar: 2 } ... turns into this: x = {foo: 1, bar: 2} When a newline is present, keep indentation as before (ie. indent one level deeper). This means this: x = { foo: 1, bar: 2 } ... turns into this: x = { foo: 1, bar: 2, }
When the collection literal doesn't begin with a newline, contents are now aligned at the same column as the starting token, so this: x = { foo: 1, bar: 2 } ... turns into this: x = {foo: 1, bar: 2} When a newline is present, keep indentation as before (ie. indent one level deeper). This means this: x = { foo: 1, bar: 2 } ... turns into this: x = { foo: 1, bar: 2, }
When the collection literal doesn't begin with a newline, contents are now aligned at the same column as the starting token, so this: x = { foo: 1, bar: 2 } ... turns into this: x = {foo: 1, bar: 2} When a newline is present, keep indentation as before (ie. indent one level deeper). This means this: x = { foo: 1, bar: 2 } ... turns into this: x = { foo: 1, bar: 2, }
all this examples add extra spaces:
The text was updated successfully, but these errors were encountered: