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

Format NamedTuple syntax #895

Open
odow opened this issue Jan 9, 2025 · 0 comments
Open

Format NamedTuple syntax #895

odow opened this issue Jan 9, 2025 · 0 comments

Comments

@odow
Copy link
Contributor

odow commented Jan 9, 2025

Sorry I tried looking for existing issues, but couldn't find one.

There are multiple ways to write a NamedTuple, and there doesn't seem to be a rule that normalizes them:

julia> (a = 1,)
(a = 1,)

julia> (; a = 1,)
(a = 1,)

julia> (; a = 1)
(a = 1,)

julia> (; :a => 1)
(a = 1,)

julia> format_text("(a = 1,)")
"(a = 1,)"

julia> format_text("(; a = 1,)")
"(; a = 1,)"

julia> format_text("(; a = 1)")
"(; a = 1)"

julia> format_text("(; :a => 1)")
"(; :a => 1)"

My preference would be:

julia> (; a = 1)
(a = 1,)

Thoughts on whether this is desirable?

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