Fix comments in tuples being dropped (fixes #37)
parent
d634d34ff1
commit
a003b932a9
|
@ -373,6 +373,16 @@ runBrittany tabSize text = do
|
|||
}
|
||||
parsePrintModule config text
|
||||
|
||||
#test issue 37
|
||||
|
||||
foo =
|
||||
( a
|
||||
, -- comment1
|
||||
b
|
||||
-- comment2
|
||||
, c
|
||||
)
|
||||
|
||||
#test issue 38
|
||||
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
|
|
@ -346,8 +346,12 @@ layoutExpr lexpr@(L _ expr) = do
|
|||
rightDoc <- docSharedWrapper layoutExpr right
|
||||
docSeq [opDoc, docSeparator, rightDoc]
|
||||
ExplicitTuple args boxity -> do
|
||||
let argExprs = fmap (\case (L _ (Present e)) -> Just e; (L _ (Missing PlaceHolder)) -> Nothing) args
|
||||
argDocs <- docSharedWrapper (maybe docEmpty layoutExpr) `mapM` argExprs
|
||||
let argExprs = args <&> \arg -> case arg of
|
||||
(L _ (Present e)) -> (arg, Just e);
|
||||
(L _ (Missing PlaceHolder)) -> (arg, Nothing)
|
||||
argDocs <- forM argExprs
|
||||
$ docSharedWrapper
|
||||
$ \(arg, exprM) -> docWrapNode arg $ maybe docEmpty layoutExpr exprM
|
||||
hasComments <- hasAnyCommentsBelow lexpr
|
||||
let (openLit, closeLit) = case boxity of
|
||||
Boxed -> (docLit $ Text.pack "(", docLit $ Text.pack ")")
|
||||
|
|
Loading…
Reference in New Issue