Clean up IndentPolicyMultiple
parent
9ab17cc899
commit
e91bb6aec9
|
@ -8,14 +8,12 @@
|
||||||
|
|
||||||
#test long
|
#test long
|
||||||
-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
|
-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
|
||||||
-- brittany { lconfig_columnAlignMode: { tag: ColumnAlignModeDisabled }}
|
|
||||||
func =
|
func =
|
||||||
mweroiuxlskdfjlksjdflkjsdfljksldkjflkjsdflkj
|
mweroiuxlskdfjlksjdflkjsdfljksldkjflkjsdflkj
|
||||||
+ mweroiuxlskdfjlksjdflkjsdfljksldkjflkjsdflkj
|
+ mweroiuxlskdfjlksjdflkjsdfljksldkjflkjsdflkj
|
||||||
|
|
||||||
#test let
|
#test let
|
||||||
-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
|
-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
|
||||||
-- brittany { lconfig_columnAlignMode: { tag: ColumnAlignModeDisabled }}
|
|
||||||
foo = do
|
foo = do
|
||||||
let
|
let
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
|
||||||
|
@ -24,7 +22,6 @@ foo = do
|
||||||
|
|
||||||
#test nested do-block
|
#test nested do-block
|
||||||
-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
|
-- brittany { lconfig_indentAmount: 4, lconfig_indentPolicy: IndentPolicyMultiple }
|
||||||
-- brittany { lconfig_columnAlignMode: { tag: ColumnAlignModeDisabled }}
|
|
||||||
foo = asdyf8asdf
|
foo = asdyf8asdf
|
||||||
"ajsdfas"
|
"ajsdfas"
|
||||||
[ asjdf asyhf $ do
|
[ asjdf asyhf $ do
|
||||||
|
|
|
@ -540,12 +540,12 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
mBindDocs <- mapM (fmap (fmap return) . docWrapNodeRest lexpr . return)
|
mBindDocs <- mapM (fmap (fmap return) . docWrapNodeRest lexpr . return)
|
||||||
=<< layoutLocalBinds binds
|
=<< layoutLocalBinds binds
|
||||||
let
|
let
|
||||||
ifIndentLeftElse :: a -> a -> a
|
ifIndentFreeElse :: a -> a -> a
|
||||||
ifIndentLeftElse x y =
|
ifIndentFreeElse x y =
|
||||||
case indentPolicy of
|
case indentPolicy of
|
||||||
IndentPolicyLeft -> x
|
IndentPolicyLeft -> y
|
||||||
IndentPolicyMultiple -> x
|
IndentPolicyMultiple -> y
|
||||||
IndentPolicyFree -> y
|
IndentPolicyFree -> x
|
||||||
-- this `docSetBaseAndIndent` might seem out of place (especially the
|
-- this `docSetBaseAndIndent` might seem out of place (especially the
|
||||||
-- Indent part; setBase is necessary due to the use of docLines below),
|
-- Indent part; setBase is necessary due to the use of docLines below),
|
||||||
-- but is here due to ghc-exactprint's DP handling of "let" in
|
-- but is here due to ghc-exactprint's DP handling of "let" in
|
||||||
|
@ -566,7 +566,7 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
[ docAlt
|
[ docAlt
|
||||||
[ docSeq
|
[ docSeq
|
||||||
[ appSep $ docLit $ Text.pack "let"
|
[ appSep $ docLit $ Text.pack "let"
|
||||||
, ifIndentLeftElse docForceSingleline docSetBaseAndIndent
|
, ifIndentFreeElse docSetBaseAndIndent docForceSingleline
|
||||||
$ bindDoc
|
$ bindDoc
|
||||||
]
|
]
|
||||||
, docAddBaseY BrIndentRegular
|
, docAddBaseY BrIndentRegular
|
||||||
|
@ -576,8 +576,8 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
]
|
]
|
||||||
, docAlt
|
, docAlt
|
||||||
[ docSeq
|
[ docSeq
|
||||||
[ appSep $ docLit $ Text.pack $ ifIndentLeftElse "in" "in "
|
[ appSep $ docLit $ Text.pack $ ifIndentFreeElse "in " "in"
|
||||||
, ifIndentLeftElse docForceSingleline docSetBaseAndIndent expDoc1
|
, ifIndentFreeElse docSetBaseAndIndent docForceSingleline expDoc1
|
||||||
]
|
]
|
||||||
, docAddBaseY BrIndentRegular
|
, docAddBaseY BrIndentRegular
|
||||||
$ docPar
|
$ docPar
|
||||||
|
@ -610,21 +610,19 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
, docAddBaseY BrIndentRegular expDoc1
|
, docAddBaseY BrIndentRegular expDoc1
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
addAlternativeCond (indentPolicy == IndentPolicyLeft)
|
addAlternative $ case indentPolicy of
|
||||||
$ docLines noHangingBinds
|
IndentPolicyLeft -> docLines noHangingBinds
|
||||||
addAlternativeCond (indentPolicy == IndentPolicyMultiple)
|
IndentPolicyMultiple -> docLines noHangingBinds
|
||||||
$ docLines noHangingBinds
|
IndentPolicyFree -> docLines
|
||||||
addAlternativeCond (indentPolicy == IndentPolicyFree)
|
[ docSeq
|
||||||
$ docLines
|
[ appSep $ docLit $ Text.pack "let"
|
||||||
[ docSeq
|
, docSetBaseAndIndent $ docLines bindDocs
|
||||||
[ appSep $ docLit $ Text.pack "let"
|
]
|
||||||
, docSetBaseAndIndent $ docLines bindDocs
|
, docSeq
|
||||||
|
[ appSep $ docLit $ Text.pack "in "
|
||||||
|
, docSetBaseY expDoc1
|
||||||
|
]
|
||||||
]
|
]
|
||||||
, docSeq
|
|
||||||
[ appSep $ docLit $ Text.pack "in "
|
|
||||||
, docSetBaseY expDoc1
|
|
||||||
]
|
|
||||||
]
|
|
||||||
addAlternative
|
addAlternative
|
||||||
$ docLines
|
$ docLines
|
||||||
[ docAddBaseY BrIndentRegular
|
[ docAddBaseY BrIndentRegular
|
||||||
|
|
Loading…
Reference in New Issue