Stream: beginners

Topic: formatter removes the empty lines I want to keep


view this post on Zulip Matthieu Pizenberg (May 09 2024 at 13:38):

Is it possible to have the formatter (0 config I know) not removes the empty line I’m letting between different blocks of code? Like here, I had an empty line above the second comment.

main =
    # first comment line
    Stdout.line! "hello"
    # formater won’t keep the empty line above
    Stdout.line! "world"

My main reason is to have visual clues of blocks of code that fit logically together.

view this post on Zulip Richard Feldman (May 09 2024 at 13:59):

yeah I've run into this too - I think this is specific to how we format !

view this post on Zulip Richard Feldman (May 09 2024 at 14:00):

I don't know if it was intentional though - @Luke Boswell might know!

view this post on Zulip Luke Boswell (May 09 2024 at 17:25):

It's not something we touched I think, but I noticed it and had an attempt at fixing it and failed.

view this post on Zulip Luke Boswell (May 09 2024 at 17:26):

I think its related to ! somehow though.. like the Stmt expression type we added isnt handled correctly like the other statements or something

view this post on Zulip Brendan Hansknecht (May 09 2024 at 19:44):

Probably not preserving whitespace when parsing or something like that?

view this post on Zulip Matthieu Pizenberg (May 09 2024 at 19:45):

could it be related to unary negation operator where you usually want to remove space with what follows?


Last updated: Jul 06 2025 at 12:14 UTC