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