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