Compare commits
4 Commits
34c8fd93d7
...
22a658e794
Author | SHA1 | Date |
---|---|---|
|
22a658e794 | |
|
354c86ef42 | |
|
a1f0529f71 | |
|
6287b66fda |
|
@ -998,3 +998,20 @@ func = do
|
||||||
func False = 0
|
func False = 0
|
||||||
-- comment
|
-- comment
|
||||||
func True = 1
|
func True = 1
|
||||||
|
|
||||||
|
#test nested do-block-with-comment issue
|
||||||
|
dofunc = do
|
||||||
|
do
|
||||||
|
some
|
||||||
|
code
|
||||||
|
do
|
||||||
|
-- abc
|
||||||
|
more
|
||||||
|
code
|
||||||
|
|
||||||
|
#test do-block paren non-alignment
|
||||||
|
catchFunc = do
|
||||||
|
(func aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
)
|
||||||
|
`catch` catcher
|
||||||
|
|
|
@ -379,6 +379,18 @@ hardcodedFixity allowUnqualify = \case
|
||||||
":>" -> fixity InfixL 9
|
":>" -> fixity InfixL 9
|
||||||
":>=" -> fixity InfixL 9
|
":>=" -> fixity InfixL 9
|
||||||
":->" -> fixity InfixL 9
|
":->" -> fixity InfixL 9
|
||||||
|
".==" -> fixity InfixN 5
|
||||||
|
"./" -> fixity InfixN 5
|
||||||
|
".<" -> fixity InfixN 5
|
||||||
|
".<=" -> fixity InfixN 5
|
||||||
|
".>" -> fixity InfixN 5
|
||||||
|
".>=" -> fixity InfixN 5
|
||||||
|
"`member`" -> fixity InfixN 8
|
||||||
|
"`notMember`" -> fixity InfixN 8
|
||||||
|
".//" -> fixity InfixL 4
|
||||||
|
".&&" -> fixity InfixR 3
|
||||||
|
".||" -> fixity InfixR 2
|
||||||
|
".=>" -> fixity InfixR 1
|
||||||
|
|
||||||
-- servant
|
-- servant
|
||||||
":>" -> fixity InfixR 4
|
":>" -> fixity InfixR 4
|
||||||
|
|
|
@ -103,7 +103,7 @@ splitModuleDecls lmod = do
|
||||||
lastSpan <- do
|
lastSpan <- do
|
||||||
finalYield $ MEExactModuleHead moduleWithoutComments
|
finalYield $ MEExactModuleHead moduleWithoutComments
|
||||||
pure
|
pure
|
||||||
$ maybe (1, 1) (ExactPrint.ss2posEnd)
|
$ maybe (0, 1) (ExactPrint.ss2posEnd)
|
||||||
$ maximumMay
|
$ maximumMay
|
||||||
$ [ GHC.anchor a
|
$ [ GHC.anchor a
|
||||||
| L a _ <- GHC.priorComments $ case hsModAnn' of
|
| L a _ <- GHC.priorComments $ case hsModAnn' of
|
||||||
|
|
|
@ -245,7 +245,8 @@ layoutOpTree allowSinglelinePar = \case
|
||||||
wrapParenMlIf x innerHead innerLines = if x
|
wrapParenMlIf x innerHead innerLines = if x
|
||||||
then wrapParenMl innerHead innerLines
|
then wrapParenMl innerHead innerLines
|
||||||
else docPar innerHead (docLines innerLines)
|
else docPar innerHead (docLines innerLines)
|
||||||
wrapParenMl innerHead innerLines = docSetBaseY $ docLines
|
wrapParenMl innerHead innerLines = docAlt
|
||||||
|
[ docForceZeroAdd $ docSetBaseY $ docLines
|
||||||
( [ docCols
|
( [ docCols
|
||||||
ColOpPrefix
|
ColOpPrefix
|
||||||
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
|
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
|
||||||
|
@ -255,6 +256,17 @@ layoutOpTree allowSinglelinePar = \case
|
||||||
++ innerLines
|
++ innerLines
|
||||||
++ [docHandleComms locC $ docLit $ Text.pack ")"]
|
++ [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
|
configAllowsParInsert <- askLayoutConf _lconfig_fixityBasedAddAlignParens
|
||||||
let allowParIns = configAllowsParInsert && case fixity of
|
let allowParIns = configAllowsParInsert && case fixity of
|
||||||
|
|
|
@ -205,7 +205,7 @@ transformAlts =
|
||||||
let ind = _acp_indent acp + _acp_indentPrep acp + indAdd
|
let ind = _acp_indent acp + _acp_indentPrep acp + indAdd
|
||||||
mSet $ acp
|
mSet $ acp
|
||||||
{ _acp_indent = ind, _acp_indentPrep = 0
|
{ _acp_indent = ind, _acp_indentPrep = 0
|
||||||
, _acp_indentPrepForced = False
|
, _acp_indentPrepForced = parentForced
|
||||||
}
|
}
|
||||||
sameLine' <- go sameLine
|
sameLine' <- go sameLine
|
||||||
mModify $ \acp' -> acp'
|
mModify $ \acp' -> acp'
|
||||||
|
|
|
@ -91,8 +91,8 @@ transformSimplifyColumns = Uniplate.rewrite $ \case
|
||||||
]
|
]
|
||||||
BDPar ind col1@(BDCols sig1 _) col2@(BDCols sig2 _) | sig1 == sig2 ->
|
BDPar ind col1@(BDCols sig1 _) col2@(BDCols sig2 _) | sig1 == sig2 ->
|
||||||
Just $ BDAddBaseY ind (BDLines [col1, col2])
|
Just $ BDAddBaseY ind (BDLines [col1, col2])
|
||||||
BDPar ind col1@(BDCols sig1 _) (BDLines (col2@(BDCols sig2 _) : rest))
|
-- BDPar ind col1@(BDCols sig1 _) (BDLines (col2@(BDCols sig2 _) : rest))
|
||||||
| sig1 == sig2 -> Just $ BDPar ind (BDLines [col1, col2]) (BDLines rest)
|
-- | sig1 == sig2 -> Just $ BDPar ind (BDLines [col1, col2]) (BDLines rest)
|
||||||
BDPar ind (BDLines lines1) col2@(BDCols sig2 _)
|
BDPar ind (BDLines lines1) col2@(BDCols sig2 _)
|
||||||
| BDCols sig1 _ <- List.last lines1, sig1 == sig2 -> Just
|
| BDCols sig1 _ <- List.last lines1, sig1 == sig2 -> Just
|
||||||
$ BDAddBaseY ind (BDLines $ lines1 ++ [col2])
|
$ BDAddBaseY ind (BDLines $ lines1 ++ [col2])
|
||||||
|
|
|
@ -44,6 +44,8 @@ transformSimplifyIndent = Uniplate.rewrite $ \case
|
||||||
Just $ BDFlushCommentsPrior c (BDAddBaseY i x)
|
Just $ BDFlushCommentsPrior c (BDAddBaseY i x)
|
||||||
BDAddBaseY i (BDFlushCommentsPost c sm x) ->
|
BDAddBaseY i (BDFlushCommentsPost c sm x) ->
|
||||||
Just $ BDFlushCommentsPost c sm (BDAddBaseY i x)
|
Just $ BDFlushCommentsPost c sm (BDAddBaseY i x)
|
||||||
|
BDAddBaseY i (BDQueueComments comms x) ->
|
||||||
|
Just $ BDQueueComments comms (BDAddBaseY i x)
|
||||||
BDAddBaseY i (BDSeq l) ->
|
BDAddBaseY i (BDSeq l) ->
|
||||||
Just $ BDSeq $ List.init l ++ [BDAddBaseY i $ List.last l]
|
Just $ BDSeq $ List.init l ++ [BDAddBaseY i $ List.last l]
|
||||||
BDAddBaseY i (BDCols sig l) ->
|
BDAddBaseY i (BDCols sig l) ->
|
||||||
|
|
Loading…
Reference in New Issue