gleam-lang/suggestions

Formatting suggestion: Keep desired line breaks

Closed this issue · 1 comments

For list, function signatures, etc
If I add a line break I would like the formatter to respect that and not try to join lines.

Examples:

let a = [
  1,
  2,
  3,
]

I would prefer the formatter not to make convert this to

let a = [1, 2, 3]

Function signatures:

pub fn tuple2(
  codec_a: Codec(a),
  codec_b: Codec(b),
 ) -> Codec(#(a, b)) {

The formatter changes this to

pub fn tuple2(codec_a: Codec(a), codec_b: Codec(b)) -> Codec(#(a, b)) {

Why?

  • Having items in different lines makes less git diff noise.
  • Each time I add or substract items the formatting can change radically (joining or splitting lines). Making a lot of diff noise.
  • In many cases is easier to read when there are line breaks (like in the function signature example above)
lpil commented

This is a good suggestion! An issue has just been opened in the gleam repo to track this, so I will close this one. Thank you