avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 146 forks source link

Formatting unspaced operators #810

Open jfmengels opened 1 year ago

jfmengels commented 1 year ago

I (too often) have code like this

Input:

a = f>>.field
b = g|>.field

Actual output (version 0.8.5):

a =
    f >>. field

b =
    g |>. field

Expected output:

a =
    f >> .field

b =
    g |> .field

I think the current behavior was correct for older versions of Elm, where >>. was potentially a valid Elm operator. Since 0.19, the operators are all known, and my thinking is that we could decide to try to end up in a state that it is more likely correct code (but is less agnostic about the operators).

avh4 commented 1 year ago

😆 FYI, you already opened this issue https://github.com/avh4/elm-format/issues/677

I'm adding a new label for issues that I think are good to do, but that will require complete knowledge of the possible operators (and thus will also require Elm 0.19): https://github.com/avh4/elm-format/labels/full%20operators%20list

jfmengels commented 1 year ago

Ugh, I looked for it too and somehow missed it :sweat_smile: Feel free to close whichever!