File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
ghcide/src/Development/IDE Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -965,12 +965,12 @@ getDocsBatch
965965 :: HscEnv
966966 -> Module -- ^ a moudle where the names are in scope
967967 -> [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 ) )))
969969getDocsBatch hsc_env _mod _names = do
970970 ((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map. fromList <$> traverse findNameInfo _names
971971 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
974974 where
975975 fun :: Map. Map Name (Either GetDocsFailure c ) -> Map. Map Name (Either T. Text c )
976976 fun =
@@ -979,8 +979,6 @@ getDocsBatch hsc_env _mod _names = do
979979 fun1 :: Either GetDocsFailure c -> Either T. Text c
980980 fun1 = first showGhc
981981
982- throwErrors = liftIO . throwIO . mkSrcErr
983-
984982 findNameInfo :: Name -> IOEnv (Env TcGblEnv TcLclEnv ) (Name , Either GetDocsFailure (Maybe HsDocString , Map. Map Int HsDocString ))
985983 findNameInfo name =
986984 case nameModule_maybe name of
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ import System.FilePath
3333
3434import Language.LSP.Types (filePathToUri , getUri )
3535import qualified Data.Map as Map
36- import Development.IDE.Types.Diagnostics (FileDiagnostic )
3736
3837mkDocMap
3938 :: HscEnv
@@ -72,11 +71,11 @@ getDocumentationsTryGhc :: HscEnv -> Module -> [Name] -> IO (Map.Map Name SpanDo
7271getDocumentationsTryGhc env mod names = do
7372 res <- fun
7473 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
7776 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
8079
8180 unwrap :: Name -> Either a (Maybe HsDocString , b ) -> IO (Name , SpanDoc )
8281 unwrap name a = (name,) . extractDocString a <$> getSpanDocUris name
You can’t perform that action at this time.
0 commit comments