NG contains an error.
This commit is contained in:
@@ -4,6 +4,7 @@ module Language.Haskell.GhcMod.ErrMsg (
|
||||
LogReader
|
||||
, setLogger
|
||||
, handleErrMsg
|
||||
, checkErrorPrefix
|
||||
) where
|
||||
|
||||
import Bag (Bag, bagToList)
|
||||
@@ -85,9 +86,12 @@ ppMsg spn sev dflag style msg = prefix ++ cts
|
||||
cts = showPage dflag style msg
|
||||
defaultPrefix
|
||||
| dopt Gap.dumpSplicesFlag dflag = ""
|
||||
| otherwise = "Dummy:0:0:Error:"
|
||||
| otherwise = checkErrorPrefix
|
||||
prefix = fromMaybe defaultPrefix $ do
|
||||
(line,col,_,_) <- Gap.getSrcSpan spn
|
||||
file <- normalise <$> Gap.getSrcFile spn
|
||||
let severityCaption = Gap.showSeverityCaption sev
|
||||
return $ file ++ ":" ++ show line ++ ":" ++ show col ++ ":" ++ severityCaption
|
||||
|
||||
checkErrorPrefix :: String
|
||||
checkErrorPrefix = "Dummy:0:0:Error:"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module Language.Haskell.GhcMod.Lint where
|
||||
|
||||
import Control.Applicative ((<$>))
|
||||
import Control.Exception (handle, SomeException(..))
|
||||
import Language.Haskell.GhcMod.ErrMsg (checkErrorPrefix)
|
||||
import Language.Haskell.GhcMod.Types
|
||||
import Language.Haskell.HLint (hlint)
|
||||
|
||||
@@ -9,7 +11,8 @@ import Language.Haskell.HLint (hlint)
|
||||
lintSyntax :: Options
|
||||
-> FilePath -- ^ A target file.
|
||||
-> IO String
|
||||
lintSyntax opt file = pack <$> hlint (file : "--quiet" : hopts)
|
||||
lintSyntax opt file = handle handler $ pack <$> hlint (file : "--quiet" : hopts)
|
||||
where
|
||||
pack = convert opt . map (init . show) -- init drops the last \n.
|
||||
hopts = hlintOpts opt
|
||||
handler (SomeException e) = return $ checkErrorPrefix ++ show e ++ "\n"
|
||||
|
||||
Reference in New Issue
Block a user