Skip to content

Commit c489a81

Browse files
committed
ghcide: Core.Compile: getDocsBatch: add doc
1 parent 5286ad7 commit c489a81

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

+5-6
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ tcRnModule hsc_env keep_lbls pmod = do
213213
HsParsedModule { hpm_module = parsedSource pmod,
214214
hpm_src_files = pm_extra_src_files pmod,
215215
hpm_annotations = pm_annotations pmod }
216-
let rn_info = case mrn_info of
217-
Just x -> x
218-
Nothing -> error "no renamed info tcRnModule"
216+
let rn_info = fromMaybe (error "no renamed info tcRnModule") mrn_info
219217
pure (TcModuleResult pmod rn_info tc_gbl_env splices False)
220218

221219
mkHiFileResultNoCompile :: HscEnv -> TcModuleResult -> IO HiFileResult
@@ -995,6 +993,7 @@ getDocsBatch
995993
-> Module -- ^ a moudle where the names are in scope
996994
-> [Name]
997995
-> IO (Either ErrorMessages (Map.Map Name (Either GetDocsFailure (Maybe HsDocString, Maybe (Map.Map Int HsDocString)))))
996+
-- ^ Return a 'Map' of 'Name's to 'Either' (no docs messages) (general doc body & arg docs)
998997
getDocsBatch hsc_env _mod _names = do
999998
((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map.fromList <$> traverse findNameInfo _names
1000999
pure $ maybeToEither errs res
@@ -1012,9 +1011,9 @@ getDocsBatch hsc_env _mod _names = do
10121011
<- loadModuleInterface "getModuleInterface" mod
10131012
pure . (name,) $
10141013
if isNothing mb_doc_hdr && Map.null dmap && Map.null amap
1015-
then Left $ NoDocsInIface mod $ compiled name
1014+
then Left $ NoDocsInIface mod $ isCompiled name
10161015
else Right (Map.lookup name dmap, Map.lookup name amap)
1017-
compiled n =
1016+
isCompiled n =
10181017
-- TODO: Find a more direct indicator.
10191018
case nameSrcLoc n of
10201019
RealSrcLoc {} -> False
@@ -1035,7 +1034,7 @@ lookupName hsc_env mod name = do
10351034
tcthing <- tcLookup name
10361035
case tcthing of
10371036
AGlobal thing -> return thing
1038-
ATcId{tct_id=id} -> return (AnId id)
1037+
ATcId{tct_id=id} -> return $ AnId id
10391038
_ -> panic "tcRnLookupName'"
10401039
return res
10411040

0 commit comments

Comments
 (0)