Make if-then-layout layout more consistent

ghc92
Lennart Spitzner 2023-03-19 18:18:26 +00:00
parent 5bee3fa93d
commit 7c329d391b
1 changed files with 6 additions and 24 deletions

View File

@ -588,7 +588,7 @@ layoutExpr lexpr@(L _ expr) = do
, docForceParSpacing thenExprDoc , docForceParSpacing thenExprDoc
] ]
, docAddBaseY BrIndentRegular , docAddBaseY BrIndentRegular
$ docPar (thenDoc) thenExprDoc $ docPar thenDoc thenExprDoc
] ]
, docAddBaseY BrIndentRegular $ docNonBottomSpacing $ docAlt , docAddBaseY BrIndentRegular $ docNonBottomSpacing $ docAlt
[ docSeq [ docSeq
@ -617,48 +617,30 @@ layoutExpr lexpr@(L _ expr) = do
-- else -- else
-- stuff -- stuff
-- note that this does _not_ have par-spacing -- note that this does _not_ have par-spacing
addAlternative $ docAddBaseY BrIndentRegular $ docPar addAlternative $ docPar
(docAddBaseY maySpecialIndent $ docSeq (docAddBaseY maySpecialIndent $ docSeq
[ -- TODO92 docNodeAnnKW lexpr Nothing $ [ appSep $ ifDoc
appSep $ ifDoc , ifExprDoc
, -- TODO92 docNodeAnnKW lexpr (Just AnnIf) $
ifExprDoc
] ]
) )
(docLines (docLines
[ docAddBaseY BrIndentRegular [ docAddBaseY BrIndentRegular
-- TODO92 $ docNodeAnnKW lexpr (Just AnnThen)
$ docAlt $ docAlt
[ docSeq [ docSeq
[ appSep $ thenDoc [ appSep $ thenDoc
, docForceParSpacing thenExprDoc , docForceParSpacing thenExprDoc
] ]
, docAddBaseY BrIndentRegular , docPar thenDoc thenExprDoc
$ docPar (thenDoc) thenExprDoc
] ]
, docAddBaseY BrIndentRegular $ docAlt , docAddBaseY BrIndentRegular $ docAlt
[ docSeq [ docSeq
[ appSep $ elseDoc [ appSep $ elseDoc
, docForceParSpacing elseExprDoc , docForceParSpacing elseExprDoc
] ]
, docAddBaseY BrIndentRegular , docPar elseDoc elseExprDoc
$ docPar elseDoc elseExprDoc
] ]
] ]
) )
addAlternative $ docSetBaseY $ docLines
[ docAddBaseY maySpecialIndent $ docSeq
[ -- TODO92 docNodeAnnKW lexpr Nothing $
appSep $ ifDoc
, -- TODO92 docNodeAnnKW lexpr (Just AnnIf) $
ifExprDoc
]
, -- TODO92 docNodeAnnKW lexpr (Just AnnThen) $
docAddBaseY BrIndentRegular
$ docPar (thenDoc) thenExprDoc
, docAddBaseY BrIndentRegular
$ docPar elseDoc elseExprDoc
]
HsMultiIf epAnn cases -> do HsMultiIf epAnn cases -> do
binderDoc <- docLit $ Text.pack "->" binderDoc <- docLit $ Text.pack "->"
let hasComments = let hasComments =