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

Inconsistent formatting between empty block and ProcLiteral #13232

Closed
HertzDevil opened this issue Mar 27, 2023 · 2 comments · Fixed by #14209
Closed

Inconsistent formatting between empty block and ProcLiteral #13232

HertzDevil opened this issue Mar 27, 2023 · 2 comments · Fixed by #14209

Comments

@HertzDevil
Copy link
Contributor

HertzDevil commented Mar 27, 2023

The formatter prefers foo { }, but ->{}; there is no space before and inside the {}. I would prefer if the latter is formatted into -> { }.

The spaces are added when something else is present:

->{}
->{ 1 }
->(x : Int32) {}
->(x : Int32) { 1 }
-> : Int32 {}
-> : Int32 { 1 }

Ideally they should be something like this:

-> { }
-> { 1 }
->(x : Int32) { }
->(x : Int32) { 1 }
-> : Int32 { }
-> : Int32 { 1 }
@straight-shoota
Copy link
Member

I don't mind the shortened form. But I'm also okay with adding some white space.

@HertzDevil
Copy link
Contributor Author

HertzDevil commented Dec 3, 2023

Same goes for do:

->do
end

->(x : Int32) do
end

-> : Int32 do
end

Note that the space in the last example is mandatory because Int32do parses to something else entirely.

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

Successfully merging a pull request may close this issue.

2 participants