From 7e1570ce44269cba4dedace6e43ebbe419d2f795 Mon Sep 17 00:00:00 2001 From: piegames Date: Mon, 15 Apr 2024 09:39:30 +0200 Subject: [PATCH] Fix #188 Fixes #188 --- src/Nixfmt/Pretty.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Nixfmt/Pretty.hs b/src/Nixfmt/Pretty.hs index 2ffdfd6f..154e3379 100644 --- a/src/Nixfmt/Pretty.hs +++ b/src/Nixfmt/Pretty.hs @@ -104,6 +104,8 @@ prettyItems sep items = prettyItems' $ unItems items prettyItems' :: (Pretty a) => [Item a] -> Doc prettyItems' [] = mempty prettyItems' [item] = pretty item + -- Fix for https://github.com/NixOS/nixfmt/issues/188 + prettyItems' [item, DetachedComments []] = pretty item prettyItems' (item : xs) = pretty item <> case item of CommentedItem _ _ -> sep; DetachedComments _ -> emptyline