Merge pull request #82 from matthew-piziak/tuple-section-support
Tuple section support (fixes #41)pull/95/head
commit
9700fb2a50
|
@ -476,9 +476,23 @@ func = (`abc` 1)
|
|||
#group tuples
|
||||
###
|
||||
|
||||
#test 1
|
||||
#test pair
|
||||
func = (abc, def)
|
||||
|
||||
#test pair section left
|
||||
func = (abc, )
|
||||
|
||||
#test pair section right
|
||||
func = (, abc)
|
||||
|
||||
#test quintuple section long
|
||||
myTupleSection =
|
||||
( verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargefirstelement
|
||||
,
|
||||
, verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargethirdelement
|
||||
,
|
||||
)
|
||||
|
||||
#test 2
|
||||
#pending
|
||||
func = (lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
|
||||
|
|
|
@ -341,9 +341,9 @@ layoutExpr lexpr@(L _ expr) = do
|
|||
opDoc <- docSharedWrapper layoutExpr op
|
||||
rightDoc <- docSharedWrapper layoutExpr right
|
||||
docSeq [opDoc, docSeparator, rightDoc]
|
||||
ExplicitTuple args boxity
|
||||
| Just argExprs <- args `forM` (\case (L _ (Present e)) -> Just e; _ -> Nothing) -> do
|
||||
argDocs <- docSharedWrapper layoutExpr `mapM` argExprs
|
||||
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
|
||||
hasComments <- hasAnyCommentsBelow lexpr
|
||||
let (openLit, closeLit) = case boxity of
|
||||
Boxed -> (docLit $ Text.pack "(", docLit $ Text.pack ")")
|
||||
|
@ -385,8 +385,6 @@ layoutExpr lexpr@(L _ expr) = do
|
|||
end = closeLit
|
||||
in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
|
||||
]
|
||||
ExplicitTuple{} ->
|
||||
unknownNodeError "ExplicitTuple|.." lexpr
|
||||
HsCase cExp (MG lmatches@(L _ matches) _ _ _) -> do
|
||||
cExpDoc <- docSharedWrapper layoutExpr cExp
|
||||
binderDoc <- docLit $ Text.pack "->"
|
||||
|
|
Loading…
Reference in New Issue