Retain comments after lambdacase and at record fields
parent
adc74d8bb1
commit
6721a44359
|
@ -1015,3 +1015,15 @@ catchFunc = do
|
|||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
`catch` catcher
|
||||
|
||||
#test comment after lambdacase
|
||||
func = \case
|
||||
-- zzz
|
||||
False -> 0
|
||||
True -> 1
|
||||
|
||||
#test comment for recordfield
|
||||
func = myRecord { field = -- comment
|
||||
if some condition then option one else option two
|
||||
, otherfield = "text"
|
||||
}
|
||||
|
|
|
@ -124,19 +124,22 @@ layoutExpr lexpr@(L _ expr) = do
|
|||
docSetParSpacing
|
||||
$ docAddBaseY BrIndentRegular
|
||||
$ (docLit $ Text.pack "\\case {}")
|
||||
HsLamCase _ (MG _ lmatches@(L _ matches) _) -> do
|
||||
HsLamCase epAnn (MG _ lmatches@(L _ matches) _) -> do
|
||||
binderDoc <- docLit $ Text.pack "->"
|
||||
layouters <- mAsk
|
||||
funcPatDocs <-
|
||||
layout_patternBind layouters Nothing binderDoc `mapM` matches
|
||||
docSetParSpacing $ docAddBaseY BrIndentRegular $ docPar
|
||||
(docLit $ Text.pack "\\case")
|
||||
( docSetBaseAndIndent
|
||||
$ docNonBottomSpacing
|
||||
$ docHandleComms lmatches
|
||||
$ docLines
|
||||
$ return <$> funcPatDocs
|
||||
)
|
||||
docSetParSpacing
|
||||
$ docAddBaseY BrIndentRegular
|
||||
$ docHandleComms epAnn
|
||||
$ docPar
|
||||
(docLit $ Text.pack "\\case")
|
||||
( docSetBaseAndIndent
|
||||
$ docNonBottomSpacing
|
||||
$ docHandleComms lmatches
|
||||
$ docLines
|
||||
$ return <$> funcPatDocs
|
||||
)
|
||||
HsApp _ exp1 _ -> do
|
||||
let gather
|
||||
:: [(EpAnnCO, LHsExpr GhcPs)]
|
||||
|
@ -1015,7 +1018,7 @@ recordExpression dotdot wrapO wrapDD wrapC indentPolicy _lexpr nameDoc nameLayou
|
|||
[AddCommaAnn span] -> Just $ epaLocationRealSrcSpanStart span
|
||||
_ -> Nothing
|
||||
SrcSpanAnn EpAnnNotUsed _ -> Nothing
|
||||
fnameDoc <- shareDoc $ nameLayouter nameThing
|
||||
fnameDoc <- shareDoc $ docHandleComms fEpAnn $ nameLayouter nameThing
|
||||
if pun
|
||||
then pure $ Left (posStart, fnameDoc)
|
||||
else do
|
||||
|
|
Loading…
Reference in New Issue