Skip to content

Commit ce1c960

Browse files
committed
ghcide: Core.Compile: getDocsBatch: no faking ArgMap, say Maybe
We can not process/reason on the ArgDoc logic - if we pretend no docs are docs. It is also aligns with main doc blocks processing.
1 parent 2085f53 commit ce1c960

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -994,12 +994,12 @@ getDocsBatch
994994
:: HscEnv
995995
-> Module -- ^ a moudle where the names are in scope
996996
-> [Name]
997-
-> IO (Either ErrorMessages (Map.Map Name (Either T.Text (Maybe HsDocString, Map.Map Int HsDocString))))
997+
-> IO (Either ErrorMessages (Map.Map Name (Either T.Text (Maybe HsDocString, Maybe (Map.Map Int HsDocString)))))
998998
getDocsBatch hsc_env _mod _names = do
999999
((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map.fromList <$> traverse findNameInfo _names
1000-
case res of
1001-
Just x -> pure $ pure $ fun x
1002-
Nothing -> pure $ Left errs
1000+
pure $ case res of
1001+
Just x -> pure $ fun x
1002+
Nothing -> Left errs
10031003
where
10041004
fun :: Map.Map Name (Either GetDocsFailure c) -> Map.Map Name (Either T.Text c)
10051005
fun =
@@ -1008,7 +1008,7 @@ getDocsBatch hsc_env _mod _names = do
10081008
fun1 :: Either GetDocsFailure c -> Either T.Text c
10091009
fun1 = first showGhc
10101010

1011-
findNameInfo :: Name -> IOEnv (Env TcGblEnv TcLclEnv) (Name, Either GetDocsFailure (Maybe HsDocString, Map.Map Int HsDocString))
1011+
findNameInfo :: Name -> IOEnv (Env TcGblEnv TcLclEnv) (Name, Either GetDocsFailure (Maybe HsDocString, Maybe (Map.Map Int HsDocString)))
10121012
findNameInfo name =
10131013
case nameModule_maybe name of
10141014
Nothing -> return (name, Left $ NameHasNoModule name)
@@ -1022,7 +1022,7 @@ getDocsBatch hsc_env _mod _names = do
10221022
pure . (name,) $
10231023
if isNothing mb_doc_hdr && Map.null dmap && Map.null amap
10241024
then Left $ NoDocsInIface mod $ compiled name
1025-
else Right (Map.lookup name dmap, Map.findWithDefault mempty name amap)
1025+
else Right (Map.lookup name dmap, Map.lookup name amap)
10261026
compiled n =
10271027
-- TODO: Find a more direct indicator.
10281028
case nameSrcLoc n of

ghcide/src/Development/IDE/Spans/Documentation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ getDocumentationsTryGhc env mod names = do
7474
Left _ -> return mempty -- catchSrcErrors (hsc_dflags env) "docs"
7575
Right res -> fmap Map.fromList $ sequenceA $ uncurry unwrap <$> Map.toList res
7676
where
77-
fun :: IO (Either ErrorMessages (Map.Map Name (Either T.Text (Maybe HsDocString, Map.Map Int HsDocString))))
77+
fun :: IO (Either ErrorMessages (Map.Map Name (Either T.Text (Maybe HsDocString, Maybe (Map.Map Int HsDocString)))))
7878
fun = getDocsBatch env mod names
7979

8080
unwrap :: Name -> Either a (Maybe HsDocString, b) -> IO (Name, SpanDoc)

0 commit comments

Comments
 (0)