This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree 1 file changed +19
-8
lines changed
src/Haskell/Ide/Engine/Plugin
1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -105,14 +105,25 @@ lintCmd = CmdSync $ \uri -> do
105
105
-- AZ:TODO: Why is this in IdeGhcM?
106
106
lintCmd' :: Uri -> IdeGhcM (IdeResult PublishDiagnosticsParams )
107
107
lintCmd' uri = pluginGetFile " lintCmd: " uri $ \ fp -> do
108
- res <- GM. withMappedFile fp $ \ file' -> liftIO $ runExceptT $ runLintCmd file' []
109
- case res of
110
- Left diags ->
111
- return (IdeResultOk (PublishDiagnosticsParams (filePathToUri fp) $ List diags))
112
- Right fs ->
113
- return $ IdeResultOk $
114
- PublishDiagnosticsParams (filePathToUri fp)
115
- $ List (map hintToDiagnostic $ stripIgnores fs)
108
+ eitherErrorResult <- GM. withMappedFile fp $ \ file' ->
109
+ liftIO (try $ runExceptT $ runLintCmd file' [] :: IO (Either SomeException (Either [Diagnostic ] [Idea ])))
110
+
111
+ case eitherErrorResult of
112
+ Left err ->
113
+ return
114
+ $ IdeResultFail (IdeError PluginError
115
+ (T. pack $ " lintCmd: " ++ show err) Null )
116
+ Right res -> case res of
117
+ Left diags ->
118
+ return
119
+ (IdeResultOk
120
+ (PublishDiagnosticsParams (filePathToUri fp) $ List diags)
121
+ )
122
+ Right fs ->
123
+ return
124
+ $ IdeResultOk
125
+ $ PublishDiagnosticsParams (filePathToUri fp)
126
+ $ List (map hintToDiagnostic $ stripIgnores fs)
116
127
117
128
runLintCmd :: FilePath -> [String ] -> ExceptT [Diagnostic ] IO [Idea ]
118
129
runLintCmd fp args = do
You can’t perform that action at this time.
0 commit comments