File tree 2 files changed +7
-10
lines changed
ghcide/src/Development/IDE
2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -965,12 +965,12 @@ getDocsBatch
965
965
:: HscEnv
966
966
-> Module -- ^ a moudle where the names are in scope
967
967
-> [Name ]
968
- -> IO (Map. Map Name (Either T. Text (Maybe HsDocString , Map. Map Int HsDocString )))
968
+ -> IO (Either ErrorMessages ( Map. Map Name (Either T. Text (Maybe HsDocString , Map. Map Int HsDocString ) )))
969
969
getDocsBatch hsc_env _mod _names = do
970
970
((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map. fromList <$> traverse findNameInfo _names
971
971
case res of
972
- Just x -> return $ fun x
973
- Nothing -> throwErrors errs
972
+ Just x -> pure $ pure $ fun x
973
+ Nothing -> pure $ Left errs
974
974
where
975
975
fun :: Map. Map Name (Either GetDocsFailure c ) -> Map. Map Name (Either T. Text c )
976
976
fun =
@@ -979,8 +979,6 @@ getDocsBatch hsc_env _mod _names = do
979
979
fun1 :: Either GetDocsFailure c -> Either T. Text c
980
980
fun1 = first showGhc
981
981
982
- throwErrors = liftIO . throwIO . mkSrcErr
983
-
984
982
findNameInfo :: Name -> IOEnv (Env TcGblEnv TcLclEnv ) (Name , Either GetDocsFailure (Maybe HsDocString , Map. Map Int HsDocString ))
985
983
findNameInfo name =
986
984
case nameModule_maybe name of
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ import System.FilePath
33
33
34
34
import Language.LSP.Types (filePathToUri , getUri )
35
35
import qualified Data.Map as Map
36
- import Development.IDE.Types.Diagnostics (FileDiagnostic )
37
36
38
37
mkDocMap
39
38
:: HscEnv
@@ -72,11 +71,11 @@ getDocumentationsTryGhc :: HscEnv -> Module -> [Name] -> IO (Map.Map Name SpanDo
72
71
getDocumentationsTryGhc env mod names = do
73
72
res <- fun
74
73
case res of
75
- Left _ -> return mempty
76
- Right res -> fmap Map. fromList $ sequenceA $ uncurry unwrap <$> Map. toList res
74
+ Left _ -> return mempty -- catchSrcErrors (hsc_dflags env) "docs"
75
+ Right res -> fmap Map. fromList $ sequenceA $ uncurry unwrap <$> Map. toList res
77
76
where
78
- fun :: IO (Either [ FileDiagnostic ] (Map. Map Name (Either T. Text (Maybe HsDocString , Map. Map Int HsDocString ))))
79
- fun = catchSrcErrors (hsc_dflags env) " docs " $ getDocsBatch env mod names
77
+ fun :: IO (Either ErrorMessages (Map. Map Name (Either T. Text (Maybe HsDocString , Map. Map Int HsDocString ))))
78
+ fun = getDocsBatch env mod names
80
79
81
80
unwrap :: Name -> Either a (Maybe HsDocString , b ) -> IO (Name , SpanDoc )
82
81
unwrap name a = (name,) . extractDocString a <$> getSpanDocUris name
You can’t perform that action at this time.
0 commit comments