tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
958 stars 83 forks source link

Always put trailing newline #741

Closed kmyk closed 3 years ago

kmyk commented 3 years ago

Is your feature request related to a problem? Please describe. Trailing newlines of files often make diffs on Git history. This is annoying. It seems the current Ormolu (0.1.4.1) keeps trailing newlines unchanged.

Describe the solution you'd like I think Ormolu should always put trailing newlines because this is an issue of formatting.

Describe alternatives you've considered We can use .editorcofing for this purpose.

amesgen commented 3 years ago

I can't reproduce this with Ormolu 0.1.4.1 on Linux; Ormolu does add trailing newlines for me:

 $ diff <(echo -n "data Test = Test") <(echo -n "data Test = Test" | ormolu)
1c1
< data Test = Test
\ No newline at end of file
---
> data Test = Test

Can you attach a file where Ormolu does not add a trailing newline?

kmyk commented 3 years ago

I tried to make such a file again, but I couldn't reproduce it. That seems to have been my misunderstanding... Sorry and thank you for checking!