Skip to content

Commit

Permalink
Experiment cont.
Browse files Browse the repository at this point in the history
  • Loading branch information
piegamesde committed Feb 7, 2024
1 parent 187704c commit d1951b5
Show file tree
Hide file tree
Showing 3 changed files with 509 additions and 501 deletions.
14 changes: 14 additions & 0 deletions src/Nixfmt/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ prettyApp indentFunction pre hasPost f a
pretty open <> pretty name <> pretty colon <> hardspace
<> prettyTermWide body
<> pretty close
absorbLast
(Term (Parenthesized
(Ann [] open Nothing)
(Application
(Term (Token (Ann [] fn@(Identifier _) Nothing)))
(Term body)
)
(Ann [] close Nothing)
))
| isAbsorbableTerm body
= group' Priority $ nest $
pretty open <> pretty fn <> hardspace
<> prettyTermWide body
<> pretty close
absorbLast (Term (Parenthesized (Ann pre' open post') expr close))
= group' Priority $ nest $ pretty (Ann pre' open Nothing)
-- Move any trailing comments on the opening parenthesis down into the body
Expand Down
22 changes: 10 additions & 12 deletions test/diff/idioms_lib_5/out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,16 @@ let
insecure = bool;
# TODO: refactor once something like Profpatsch's types-simple will land
# This is currently dead code due to https://github.com/NixOS/nix/issues/2532
tests = attrsOf (
mkOptionType {
name = "test";
check =
x:
x == { }
||
# Accept {} for tests that are unsupported
(isDerivation x && x ? meta.timeout);
merge = lib.options.mergeOneOption;
}
);
tests = attrsOf (mkOptionType {
name = "test";
check =
x:
x == { }
||
# Accept {} for tests that are unsupported
(isDerivation x && x ? meta.timeout);
merge = lib.options.mergeOneOption;
});
timeout = int;

# Needed for Hydra to expose channel tarballs:
Expand Down
Loading

0 comments on commit d1951b5

Please sign in to comment.