diff --git a/src/Nixfmt/Pretty.hs b/src/Nixfmt/Pretty.hs index ae3e305..9c80c10 100644 --- a/src/Nixfmt/Pretty.hs +++ b/src/Nixfmt/Pretty.hs @@ -398,7 +398,7 @@ prettyApp indentFunction pre hasPost f a = -- If lists have only simple items, try to render them single-line instead of expanding -- This is just a copy of the list rendering code, but with `sepBy line` instead of `sepBy hardline` absorbInner (Term (List paropen@Ann{trailComment = post'} items parclose)) - | length (unItems items) <= 4 && all (isSimple . Term) items = + | length (unItems items) <= 6 && all (isSimple . Term) items = pretty (paropen{trailComment = Nothing}) <> surroundWith sur (nest $ pretty post' <> sepBy line (unItems items)) <> pretty parclose diff --git a/test/diff/apply_with_lists/out-pure.nix b/test/diff/apply_with_lists/out-pure.nix index edf22e6..6c33da7 100644 --- a/test/diff/apply_with_lists/out-pure.nix +++ b/test/diff/apply_with_lists/out-pure.nix @@ -18,22 +18,7 @@ [ ''\"'' "\\\\" ] name ) - (replaceStrings - [ - "@" - ":" - "\\" - "[" - "]" - ] - [ - "-" - "-" - "-" - "" - "" - ] - ) + (replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]) (lists.removePrefix [ 1 @@ -67,13 +52,7 @@ [ "hardware" "graphics" ] ) (mkRenamedOptionModule - [ - "services" - "xserver" - "displayManager" - "sddm" - "enable" - ] + [ "services" "xserver" "displayManager" "sddm" "enable" ] [ "services" "displayManager" "sddm" "enable" ] ) (map ( diff --git a/test/diff/apply_with_lists/out.nix b/test/diff/apply_with_lists/out.nix index 580e2b6..bee7df4 100644 --- a/test/diff/apply_with_lists/out.nix +++ b/test/diff/apply_with_lists/out.nix @@ -18,22 +18,7 @@ [ ''\"'' "\\\\" ] name ) - (replaceStrings - [ - "@" - ":" - "\\" - "[" - "]" - ] - [ - "-" - "-" - "-" - "" - "" - ] - ) + (replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]) (lists.removePrefix [ 1