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
Based upon the discussion in domluna/JuliaFormatter.jl#455 I think there may be some clarification needed on the use of trailing comma when multiple arguments are on the same line. The intent of this section seems to imply that a trailing comma should always be used when an ending bracket does not immediately proceed the last argument:
Assignments using expanded notation for arrays or tuples, or function calls should have the first open bracket on the same line assignment operator and the closing bracket should match the indentation level of the assignment. Alternatively you can perform assignments on a single line when they are short:
Some concrete examples of what this interpretation implies:
result =Function(
arg1, arg2,
)
result =Function(arg1, arg2)
The original intent on having a trailing comma at all was to reduce the diff churn when additional arguments were added at the end of the list. This is definitely the most important when having an single argument on each line.
Related: we may also want to define some rules around when to switch between using:
# 1f(a, b)
# 2f(
a, b,
)
#3 f(
a,
b,
)
It appears that the JuliaFormatter often prefers #2 and only uses #3 when the argument list is so long that it extends beyond the line length. Personally, I'd prefer if the formatter left the call to use #2 or #3 up to discretion the writer and just enforces that one of the preferred styles is used.
The text was updated successfully, but these errors were encountered:
Based upon the discussion in domluna/JuliaFormatter.jl#455 I think there may be some clarification needed on the use of trailing comma when multiple arguments are on the same line. The intent of this section seems to imply that a trailing comma should always be used when an ending bracket does not immediately proceed the last argument:
Some concrete examples of what this interpretation implies:
The original intent on having a trailing comma at all was to reduce the diff churn when additional arguments were added at the end of the list. This is definitely the most important when having an single argument on each line.
Related: we may also want to define some rules around when to switch between using:
It appears that the JuliaFormatter often prefers
#2
and only uses#3
when the argument list is so long that it extends beyond the line length. Personally, I'd prefer if the formatter left the call to use#2
or#3
up to discretion the writer and just enforces that one of the preferred styles is used.The text was updated successfully, but these errors were encountered: