unison icon indicating copy to clipboard operation
unison copied to clipboard

LSP formatting swaps type constructors on save

Open andreystepanov opened this issue 4 months ago • 3 comments

Scratch code:

type Issue = One | Two | Three | Unknown Text

fromText : Text -> Issue
fromText =
  cases
    x | x == "one" -> One
      | x == "two" -> Two
      | x == "three" -> Three
      | otherwise -> Unknown x

Gets formatted into:

type Issue = One | Two | Three | Unknown Text

fromText : Text -> Issue
fromText = cases
  x 
    | x Text.== "one"   -> Two
    | x Text.== "two"   -> Three
    | x Text.== "three" -> Unknown
    | otherwise         -> One x

As you can see constructors got swapped in some weird order.

andreystepanov avatar Feb 16 '24 09:02 andreystepanov