Skip to content

Commit

Permalink
Only move non-empty lines below the in
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed May 14, 2024
1 parent 0e348cb commit 2ed49bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Nixfmt/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,10 @@ instance Pretty Expression where
(binderComments, bindersWithoutComments) =
foldr
( \item (start, rest) -> case item of
(Comments inner) | null rest -> (inner : start, rest)
(Comments inner)
| null rest ->
let (comments, el) = break (== EmptyLine) (reverse inner)
in (reverse comments : start, Comments (reverse el) : rest)
_ -> (start, item : rest)
)
([], [])
Expand Down

0 comments on commit 2ed49bb

Please sign in to comment.