Stream: ideas

Topic: formating: 2 empty lines between top level values


view this post on Zulip Artur Domurad (Dec 06 2023 at 12:29):

What do you think about adding 2 empty lines between top level values/functions in roc format?

Not sure if it is the default setting, but elm-format always adds 2 empty line in my elm code - and I really like it!
It is very easy to visually partition the code into seperate blocks this way.

view this post on Zulip Anton (Dec 06 2023 at 12:31):

I like it too!

view this post on Zulip Brendan Hansknecht (Dec 06 2023 at 16:13):

I think it is a good idea.

view this post on Zulip LoipesMas (Dec 06 2023 at 21:45):

I was surprised that it doesn't

view this post on Zulip Richard Feldman (Dec 06 2023 at 22:39):

fine by me! I don't have strong feelings one way or the other

view this post on Zulip Richard Feldman (Dec 06 2023 at 22:40):

if anyone wants to make a PR to introduce it, go for it!

view this post on Zulip Ryan Bates (Dec 06 2023 at 23:01):

I've been adding two lines and was surprised when roc format converted it to one line.

However if I have a lot of top level expect lines I don't think they should have two lines between them.

view this post on Zulip Isaac Van Doren (Dec 06 2023 at 23:12):

Yeah, sometimes it is very nice to have lots of expects close together

view this post on Zulip Isaac Van Doren (Dec 06 2023 at 23:13):

Or even just a top level declaration and a related expect separated by a single line to show that they are grouped. It would be very nice if there is a reasonable way for the formatter to still allow this

view this post on Zulip Richard Feldman (Dec 07 2023 at 01:14):

hmm yeah I also like expects side by side, like no blank lines at all if they're one-liners

view this post on Zulip Luke Boswell (Dec 07 2023 at 03:20):

Same with constants for me.

Maybe we could have two spaces only before comments or annotations (both function and types) instead?

view this post on Zulip Luke Boswell (Dec 07 2023 at 03:21):

Like, sometimes I like having a bunch of related things and grouping them without spaces. But almost always these dont have an annotation.

view this post on Zulip Richard Feldman (Dec 07 2023 at 03:25):

that sounds like a reasonable heuristic to me!

view this post on Zulip Luke Boswell (Dec 07 2023 at 23:15):

I've been writing a lot of html recently and the current formatter can make some strange decisions, is it easy enough to tinker with it? I am thinking it would be nice to be able to tweak it as I find issues and make a PR with my reccomendations. I appreciate that there is a lot of personal preference here, but it's not easy to neatly describe specific issues.

view this post on Zulip Richard Feldman (Dec 08 2023 at 00:51):

yeah I think it's relatively straightforward to tinker with, but lmk if you have any specific questions!


Last updated: Jun 16 2026 at 16:19 UTC