@@ -39,7 +39,6 @@ import Development.IDE.GHC.Error
39
39
import Development.IDE.GHC.Orphans ()
40
40
import Development.IDE.GHC.Util
41
41
import Development.IDE.GHC.Warnings
42
- import Development.IDE.Spans.Common
43
42
import Development.IDE.Types.Diagnostics
44
43
import Development.IDE.Types.Location
45
44
import Development.IDE.Types.Options
@@ -75,7 +74,7 @@ import Control.Lens hiding (List)
75
74
import Control.Monad.Except
76
75
import Control.Monad.Extra
77
76
import Control.Monad.Trans.Except
78
- import Data.Bifunctor (first , second )
77
+ import Data.Bifunctor (second )
79
78
import qualified Data.ByteString as BS
80
79
import qualified Data.DList as DL
81
80
import Data.IORef
@@ -104,6 +103,7 @@ import Data.Functor
104
103
import qualified Data.HashMap.Strict as HashMap
105
104
import Data.Map (Map )
106
105
import Data.Tuple.Extra (dupe )
106
+ import Data.Either.Extra (maybeToEither )
107
107
import Data.Unique as Unique
108
108
import Development.IDE.Core.Tracing (withTrace )
109
109
import Development.IDE.GHC.Compat.Util (emptyUDFM , plusUDFM )
@@ -994,20 +994,11 @@ getDocsBatch
994
994
:: HscEnv
995
995
-> Module -- ^ a moudle where the names are in scope
996
996
-> [Name ]
997
- -> IO (Either ErrorMessages (Map. Map Name (Either T. Text (Maybe HsDocString , Maybe (Map. Map Int HsDocString )))))
997
+ -> IO (Either ErrorMessages (Map. Map Name (Either GetDocsFailure (Maybe HsDocString , Maybe (Map. Map Int HsDocString )))))
998
998
getDocsBatch hsc_env _mod _names = do
999
999
((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map. fromList <$> traverse findNameInfo _names
1000
- pure $ case res of
1001
- Just x -> pure $ fun x
1002
- Nothing -> Left errs
1003
- where
1004
- fun :: Map. Map Name (Either GetDocsFailure c ) -> Map. Map Name (Either T. Text c )
1005
- fun =
1006
- Map. map fun1
1007
- where
1008
- fun1 :: Either GetDocsFailure c -> Either T. Text c
1009
- fun1 = first showGhc
1010
-
1000
+ pure $ maybeToEither errs res
1001
+ where
1011
1002
findNameInfo :: Name -> IOEnv (Env TcGblEnv TcLclEnv ) (Name , Either GetDocsFailure (Maybe HsDocString , Maybe (Map. Map Int HsDocString )))
1012
1003
findNameInfo name =
1013
1004
case nameModule_maybe name of
0 commit comments