You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Ormolu sometimes eats line breaks after infix operators, and replaces them with hanging indents.
To Reproduce
Run ormolu on code similar to:
test::Spec
test =
describe "An example specification"$
it "An example test case"$
[ someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample
]
`shouldWithSomeHandwavingBeVeryApproximatelyEqualTo`
[ someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample
]
Notice the line break after the infix operator.
Expected behaviour
The line break is preserved, and the subsequent expression is rendered to the right by one indent level.
Actual behaviour
The line break is removed, and the subsequent expression is rendered with a hanging indent:
test::Spec
test =
describe "An example specification"$
it "An example test case"$
[ someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample
]
`shouldWithSomeHandwavingBeVeryApproximatelyEqualTo` [ someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample,
someRatherLongExpressionToServeAsAnIlluminatingExample
]
Environment
OS name + version: Linux 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 GNU/Linux
Version of the code: ormolu 0.5.1.0 UNKNOWN UNKNOWN using ghc-lib-parser 9.4.3.20221104
Additional context
We have a rather large code base (> 200,000 lines) that's formatted by hand, and we're interested in adopting an auto-formatter.
Our team coding standard:
encourages an 80-column limit.
discourages hanging indents, preferring line breaks and indentation over vertical alignment.
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
The text was updated successfully, but these errors were encountered:
Describe the bug
Ormolu sometimes eats line breaks after infix operators, and replaces them with hanging indents.
To Reproduce
Run
ormolu
on code similar to:Notice the line break after the infix operator.
Expected behaviour
The line break is preserved, and the subsequent expression is rendered to the right by one indent level.
Actual behaviour
The line break is removed, and the subsequent expression is rendered with a hanging indent:
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
The text was updated successfully, but these errors were encountered: