Fix paren-multiline-expression in do block
parent
b874175986
commit
adc74d8bb1
|
@ -1008,3 +1008,10 @@ dofunc = do
|
|||
-- abc
|
||||
more
|
||||
code
|
||||
|
||||
#test do-block paren non-alignment
|
||||
catchFunc = do
|
||||
(func aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
`catch` catcher
|
||||
|
|
|
@ -245,16 +245,28 @@ layoutOpTree allowSinglelinePar = \case
|
|||
wrapParenMlIf x innerHead innerLines = if x
|
||||
then wrapParenMl innerHead innerLines
|
||||
else docPar innerHead (docLines innerLines)
|
||||
wrapParenMl innerHead innerLines = docSetBaseY $ docLines
|
||||
( [ docCols
|
||||
ColOpPrefix
|
||||
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
|
||||
, docHandleComms locO $ innerHead
|
||||
]
|
||||
]
|
||||
++ innerLines
|
||||
++ [docHandleComms locC $ docLit $ Text.pack ")"]
|
||||
)
|
||||
wrapParenMl innerHead innerLines = docAlt
|
||||
[ docForceZeroAdd $ docSetBaseY $ docLines
|
||||
( [ docCols
|
||||
ColOpPrefix
|
||||
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
|
||||
, docHandleComms locO $ innerHead
|
||||
]
|
||||
]
|
||||
++ innerLines
|
||||
++ [docHandleComms locC $ docLit $ Text.pack ")"]
|
||||
)
|
||||
, docPar
|
||||
(docCols
|
||||
ColOpPrefix
|
||||
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
|
||||
, docHandleComms locO $ innerHead
|
||||
]
|
||||
)
|
||||
( docLines
|
||||
$ innerLines ++ [docHandleComms locC $ docLit $ Text.pack ")"]
|
||||
)
|
||||
]
|
||||
|
||||
configAllowsParInsert <- askLayoutConf _lconfig_fixityBasedAddAlignParens
|
||||
let allowParIns = configAllowsParInsert && case fixity of
|
||||
|
|
|
@ -205,7 +205,7 @@ transformAlts =
|
|||
let ind = _acp_indent acp + _acp_indentPrep acp + indAdd
|
||||
mSet $ acp
|
||||
{ _acp_indent = ind, _acp_indentPrep = 0
|
||||
, _acp_indentPrepForced = False
|
||||
, _acp_indentPrepForced = parentForced
|
||||
}
|
||||
sameLine' <- go sameLine
|
||||
mModify $ \acp' -> acp'
|
||||
|
|
|
@ -91,8 +91,8 @@ transformSimplifyColumns = Uniplate.rewrite $ \case
|
|||
]
|
||||
BDPar ind col1@(BDCols sig1 _) col2@(BDCols sig2 _) | sig1 == sig2 ->
|
||||
Just $ BDAddBaseY ind (BDLines [col1, col2])
|
||||
BDPar ind col1@(BDCols sig1 _) (BDLines (col2@(BDCols sig2 _) : rest))
|
||||
| sig1 == sig2 -> Just $ BDPar ind (BDLines [col1, col2]) (BDLines rest)
|
||||
-- BDPar ind col1@(BDCols sig1 _) (BDLines (col2@(BDCols sig2 _) : rest))
|
||||
-- | sig1 == sig2 -> Just $ BDPar ind (BDLines [col1, col2]) (BDLines rest)
|
||||
BDPar ind (BDLines lines1) col2@(BDCols sig2 _)
|
||||
| BDCols sig1 _ <- List.last lines1, sig1 == sig2 -> Just
|
||||
$ BDAddBaseY ind (BDLines $ lines1 ++ [col2])
|
||||
|
|
Loading…
Reference in New Issue