You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alias Ax = NamedTuple(
a: String
)
alias Bx = NamedTuple(
b: String,
)
x = {
"name" => "Crystal"
}
y = {
"name" => "Crystal",
}
running format:
crystal tool format
alias Ax = NamedTuple(
a: String)
alias Bx = NamedTuple(
b: String,
)
x = {
"name" => "Crystal",
}
y = {
"name" => "Crystal",
}
In the Hash a trailing comma was added, in the NamedTuple the trailing newline was removed and no trailing comma was added.
IMHO the correct behavior would be that in NamedTuples too the formatter will add a trailing comma and a newline after it.
So this is the expected output:
alias Ax = NamedTuple(
a: String,
)
alias Bx = NamedTuple(
b: String,
)
x = {
"name" => "Crystal",
}
y = {
"name" => "Crystal",
}
Even if a trailing comma is not added, IMHO the trailing newline should not be removed.
Test case for spec/compiler/formatter/formatter_spec.cr if trailing comma is expected:
Original file:
running format:
crystal tool format
In the Hash a trailing comma was added, in the NamedTuple the trailing newline was removed and no trailing comma was added.
IMHO the correct behavior would be that in NamedTuples too the formatter will add a trailing comma and a newline after it.
So this is the expected output:
Even if a trailing comma is not added, IMHO the trailing newline should not be removed.
Test case for
spec/compiler/formatter/formatter_spec.cr
if trailing comma is expected:Test case if leaving the trailing newline is expected:
The text was updated successfully, but these errors were encountered: