first try to resolve #322.
This commit is contained in:
@@ -21,13 +21,8 @@ import Language.Haskell.GhcMod.Target (setTargetFiles)
|
||||
checkSyntax :: IOish m
|
||||
=> [FilePath] -- ^ The target files.
|
||||
-> GhcModT m String
|
||||
checkSyntax [] = return ""
|
||||
checkSyntax files = withErrorHandler sessionName $
|
||||
either id id <$> check files
|
||||
where
|
||||
sessionName = case files of
|
||||
[file] -> file
|
||||
_ -> "MultipleFiles"
|
||||
checkSyntax [] = return ""
|
||||
checkSyntax files = withErrorHandler $ either id id <$> check files
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
@@ -51,13 +46,8 @@ check fileNames = overrideGhcUserOptions $ \ghcOpts -> do
|
||||
expandTemplate :: IOish m
|
||||
=> [FilePath] -- ^ The target files.
|
||||
-> GhcModT m String
|
||||
expandTemplate [] = return ""
|
||||
expandTemplate files = withErrorHandler sessionName $
|
||||
either id id <$> expand files
|
||||
where
|
||||
sessionName = case files of
|
||||
[file] -> file
|
||||
_ -> "MultipleFiles"
|
||||
expandTemplate [] = return ""
|
||||
expandTemplate files = withErrorHandler $ either id id <$> expand files
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -273,13 +273,13 @@ runGhcModT' r s a = do
|
||||
return (res, w')
|
||||
----------------------------------------------------------------
|
||||
|
||||
withErrorHandler :: IOish m => String -> GhcModT m a -> GhcModT m a
|
||||
withErrorHandler label = ghandle ignore
|
||||
withErrorHandler :: IOish m => GhcModT m a -> GhcModT m a
|
||||
withErrorHandler = ghandle ignore
|
||||
where
|
||||
ignore :: IOish m => SomeException -> GhcModT m a
|
||||
ignore e = liftIO $ do
|
||||
hPutStr stderr $ label ++ ":0:0:Error:"
|
||||
hPrint stderr e
|
||||
-- FIXME: should print NG
|
||||
exitSuccess
|
||||
|
||||
-- | Make a copy of the 'gmGhcSession' IORef, run the action and restore the
|
||||
|
||||
Reference in New Issue
Block a user