Skip to content

Commit

Permalink
Test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
piegamesde committed Feb 6, 2024
1 parent 7a36e69 commit 9a9a6e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Nixfmt/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,19 @@ prettyTerm (Set krec paropen items parclose) = prettySet False (krec, paropen, i

-- Parentheses
prettyTerm (Parenthesized paropen expr parclose)
= group $ pretty (moveTrailingCommentUp paropen) <> inner <> pretty parclose
= group $ pretty (moveTrailingCommentUp paropen) <> nest inner <> pretty parclose
where
inner =
case expr of
-- Start on the same line for these
_ | isAbsorbableExpr expr -> nest $ group $ absorbExpr False expr
_ | isAbsorbableExpr expr -> group $ absorbExpr False expr
-- Parenthesized application
(Application f a) -> nest $ prettyApp False mempty True f a
(Application f a) -> prettyApp False mempty True f a
-- Same thing for selections
(Term (Selection t _)) | isAbsorbable t -> line' <> (nest $ group $ expr) <> line'
(Term (Selection _ _)) -> (nest $ group $ expr) <> line'
(Term (Selection t _)) | isAbsorbable t -> line' <> group expr <> line'
(Term (Selection _ _)) -> group expr <> line'
-- Start on a new line for the others
_ -> line' <> (nest $ group $ expr) <> line'
_ -> line' <> group expr <> line'

instance Pretty Term where
pretty l@List{} = group $ prettyTerm l
Expand Down

0 comments on commit 9a9a6e6

Please sign in to comment.