diff --git a/src/Nixfmt/Pretty.hs b/src/Nixfmt/Pretty.hs index 49c4525..9d549cc 100644 --- a/src/Nixfmt/Pretty.hs +++ b/src/Nixfmt/Pretty.hs @@ -600,7 +600,11 @@ absorbRHS expr = case expr of -- Special case `//` and `++` operations to be more compact in some cases -- Case 1: two arguments, LHS is absorbable term, RHS fits onto the last line (Operation (Term t) (LoneAnn op) b) - | isAbsorbable t && isUpdateOrConcat op -> + | isAbsorbable t + && isUpdateOrConcat op + -- Exclude further operations on the RHS + -- Hotfix for https://github.com/NixOS/nixfmt/issues/198 + && case b of (Operation{}) -> False; _ -> True -> group' RegularG $ line <> group' Priority (prettyTermWide t) <> line <> pretty op <> hardspace <> pretty b -- Case 2a: LHS fits onto first line, RHS is an absorbable term (Operation l (LoneAnn op) (Term t)) diff --git a/test/diff/idioms_nixos_2/out-pure.nix b/test/diff/idioms_nixos_2/out-pure.nix index 98e94de..d0403c7 100644 --- a/test/diff/idioms_nixos_2/out-pure.nix +++ b/test/diff/idioms_nixos_2/out-pure.nix @@ -51,7 +51,8 @@ let post_max_size = cfg.maxUploadSize; memory_limit = cfg.maxUploadSize; } - // cfg.phpOptions // optionalAttrs cfg.caching.apcu { "apc.enable_cli" = "1"; }; + // cfg.phpOptions + // optionalAttrs cfg.caching.apcu { "apc.enable_cli" = "1"; }; occ = pkgs.writeScriptBin "nextcloud-occ" '' #! ${pkgs.runtimeShell}