Allow special layout for HsApp with HsDo/HsSpiceE args
parent
209fdc74a2
commit
6cd83c9d39
|
@ -306,15 +306,14 @@ parserCompactLocation =
|
||||||
[ try
|
[ try
|
||||||
$ [ ParseRelAbs (Text.Read.read digits) _ _
|
$ [ ParseRelAbs (Text.Read.read digits) _ _
|
||||||
| digits <- many1 digit
|
| digits <- many1 digit
|
||||||
, rel1 :: Maybe (Either Int (Ratio Int)) <-
|
, rel1 :: Maybe (Either Int (Ratio Int)) <- optionMaybe
|
||||||
optionMaybe
|
[ case divPart of
|
||||||
[ case divPart of
|
Nothing -> Left $ Text.Read.read digits
|
||||||
Nothing -> Left $ Text.Read.read digits
|
Just ddigits ->
|
||||||
Just ddigits ->
|
Right $ Text.Read.read digits % Text.Read.read ddigits
|
||||||
Right $ Text.Read.read digits % Text.Read.read ddigits
|
| digits <- many1 digit
|
||||||
| digits <- many1 digit
|
, divPart <- optionMaybe (string "/" *> many1 digit)
|
||||||
, divPart <- optionMaybe (string "/" *> many1 digit)
|
]
|
||||||
]
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -938,3 +937,22 @@ tzejubuVxairoy
|
||||||
-- foo bar
|
-- foo bar
|
||||||
=> CUR.Ozuzcak zub
|
=> CUR.Ozuzcak zub
|
||||||
-> m ()
|
-> m ()
|
||||||
|
|
||||||
|
#test allow par-spacing for HsApp HsDo
|
||||||
|
func = other $ meep
|
||||||
|
do
|
||||||
|
abc
|
||||||
|
def
|
||||||
|
(some other very long linnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnne)
|
||||||
|
|
||||||
|
#test allow par-spacing for HsApp HsDo
|
||||||
|
func = other $ meep
|
||||||
|
[ x | x <- myList ]
|
||||||
|
(some other very long linnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnne)
|
||||||
|
|
||||||
|
#test allow par-spacing for HsApp HsSpliceE
|
||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
func = other $ meep
|
||||||
|
[q|hello
|
||||||
|
world|]
|
||||||
|
(some other very long linnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnne)
|
||||||
|
|
|
@ -1252,15 +1252,14 @@ parserCompactLocation =
|
||||||
[ try
|
[ try
|
||||||
$ [ ParseRelAbs (Text.Read.read digits) _ _
|
$ [ ParseRelAbs (Text.Read.read digits) _ _
|
||||||
| digits <- many1 digit
|
| digits <- many1 digit
|
||||||
, rel1 :: Maybe (Either Int (Ratio Int)) <-
|
, rel1 :: Maybe (Either Int (Ratio Int)) <- optionMaybe
|
||||||
optionMaybe
|
[ case divPart of
|
||||||
[ case divPart of
|
Nothing -> Left $ Text.Read.read digits
|
||||||
Nothing -> Left $ Text.Read.read digits
|
Just ddigits ->
|
||||||
Just ddigits ->
|
Right $ Text.Read.read digits % Text.Read.read ddigits
|
||||||
Right $ Text.Read.read digits % Text.Read.read ddigits
|
| digits <- many1 digit
|
||||||
| digits <- many1 digit
|
, divPart <- optionMaybe (string "/" *> many1 digit)
|
||||||
, divPart <- optionMaybe (string "/" *> many1 digit)
|
]
|
||||||
]
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,8 @@ layoutExpr lexpr@(L _ expr) = do
|
||||||
(_, L _ ExplicitTuple{}) -> True
|
(_, L _ ExplicitTuple{}) -> True
|
||||||
(_, L _ ExplicitList{}) -> True
|
(_, L _ ExplicitList{}) -> True
|
||||||
(_, L _ HsPar{}) -> True
|
(_, L _ HsPar{}) -> True
|
||||||
|
(_, L _ HsDo{}) -> True
|
||||||
|
(_, L _ HsSpliceE{}) -> True
|
||||||
_ -> False
|
_ -> False
|
||||||
let wrap = if all checkAllowPar paramEs then docSetParSpacing else id
|
let wrap = if all checkAllowPar paramEs then docSetParSpacing else id
|
||||||
wrap $ docAddBaseY BrIndentRegular $ docPar
|
wrap $ docAddBaseY BrIndentRegular $ docPar
|
||||||
|
|
Loading…
Reference in New Issue