Skip to content
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

join_lines_based_on_source=true vs 1-argument trailing comma #829

Open
mortenpi opened this issue Apr 9, 2024 · 0 comments
Open

join_lines_based_on_source=true vs 1-argument trailing comma #829

mortenpi opened this issue Apr 9, 2024 · 0 comments

Comments

@mortenpi
Copy link

mortenpi commented Apr 9, 2024

There is the 1-argument edge case trailing commas, where JuliaFormatter removes the trailing comma, but in my opinion it should stay (the standard diffing argument). I.e.

xs = [
    1,
]

vs

xs = [
    1
]

and

foo(
    1,
)

vs

foo(
    1
)

JuliaFormatter will format to the latter, but I think it should keep the comma.

julia> format_text("""
       [
         x,
       ]
       """, style=BlueStyle(), trailing_comma=true, join_lines_based_on_source=true) |> println
[
    x
]

There is the similar discussion in #455, but I feel that it might be a separate issue, since without join_lines_based_on_source=true, JuliaFormatter collapses everything into a single line, so you don't see the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant