Respect and Fix disable-next-binding/decl
parent
fe876ea0b0
commit
84e703d7f3
|
@ -22,7 +22,6 @@ import GHC.Parser.Annotation ( EpaCommentTok
|
|||
)
|
||||
)
|
||||
import qualified UI.Butcher.Monadic as Butcher
|
||||
-- import qualified Language.Haskell.GHC.ExactPrint.Utils as ExactPrint.Utils
|
||||
import Control.Monad.Trans.Except
|
||||
|
||||
import Language.Haskell.Brittany.Internal.Config.Config
|
||||
|
@ -31,6 +30,8 @@ import Language.Haskell.Brittany.Internal.Util.AST
|
|||
import Language.Haskell.Brittany.Internal.Config.Types.Instances1 ()
|
||||
import Language.Haskell.Brittany.Internal.Config.Types.Instances2 ()
|
||||
-- import Language.Haskell.Brittany.Internal.Utils
|
||||
-- import qualified Language.Haskell.GHC.ExactPrint.Utils as ExactPrint.Utils
|
||||
-- import Data.Data(toConstr)
|
||||
|
||||
|
||||
|
||||
|
@ -39,6 +40,7 @@ data InlineConfigTarget
|
|||
| InlineConfigTargetNextDecl -- really only next in module
|
||||
| InlineConfigTargetNextBinding -- by name
|
||||
| InlineConfigTargetBinding String
|
||||
deriving Show
|
||||
|
||||
extractCommentConfigs
|
||||
:: (String -> IO ())
|
||||
|
@ -116,13 +118,13 @@ extractCommentConfigs _putErrorLn modul = do
|
|||
]
|
||||
let perSpan = Map.fromListWith
|
||||
(<>)
|
||||
[ (srcSpan, conf)
|
||||
[ (declSpan, conf)
|
||||
| (srcSpan, target, conf) <- lineConfigs
|
||||
, let perBindRes = Map.lookupGT srcSpan declMap
|
||||
, Just (declSpan, names) <- [Map.lookupGT srcSpan declMap]
|
||||
, case target of
|
||||
InlineConfigTargetNextDecl -> True
|
||||
InlineConfigTargetNextBinding | Nothing <- perBindRes -> True
|
||||
_ -> False
|
||||
InlineConfigTargetNextDecl -> True
|
||||
InlineConfigTargetNextBinding -> null names
|
||||
_ -> False
|
||||
]
|
||||
|
||||
pure
|
||||
|
|
|
@ -218,7 +218,8 @@ ppToplevelDecl decl immediateAfterComms = do
|
|||
declConfig & _conf_roundtrip_exactprint_only & confUnpack
|
||||
bd <- fmap fst $ if exactprintOnly
|
||||
then briDocMToPPM layouters
|
||||
$ docSeq (briDocByExact decl : map commentToDoc immediateAfterComms)
|
||||
$ docSeq
|
||||
(briDocByExactNoComment decl : map commentToDoc immediateAfterComms)
|
||||
else do
|
||||
let innerDoc = case decl of
|
||||
L (SrcSpanAnn _ (GHC.RealSrcSpan s _)) _ ->
|
||||
|
|
Loading…
Reference in New Issue