Closed jonathanknowles closed 8 months ago
I think respecting line breaks here sounds reasonable, it gets even more annoying with CTYPE
pragmas:
data
{-# CTYPE "header.h" "an-ffi-type-with-along-name" #-}
AnFFITypeWithAlongName = AnFFITypeWithAlongName
{ a :: X,
b :: Y
}
is formatted to
data {-# CTYPE "header.h" "an-ffi-type-with-along-name" #-} AnFFITypeWithAlongName = AnFFITypeWithAlongName
{ a :: X,
b :: Y
}
without a way to force line breaks without adding bogus comments.
Describe the bug Ormolu sometimes eats line breaks within data type declarations.
To Reproduce Run ormolu on code similar to the following, with a line break before the
=
:or with the line break after the
=
:Expected behaviour The line break is preserved, and the data constructor name is indented one level to the right.
Actual behaviour Ormolu eats the line break, and prints the data constructor name on the same line, resulting in a rather long line:
Environment
Linux 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 GNU/Linux
ormolu 0.5.1.0 UNKNOWN UNKNOWN using ghc-lib-parser 9.4.3.20221104
Additional context
We realise that ormolu does not provide support for a column limit, but we're wondering if we can get by with manually inserting line breaks where necessary.
Many thanks! Jonathan