Skip to content

Commit 8aaf5ca

Browse files
committed
ghcide: Core.Compile: getDocsBatch: add doc
1 parent 2e306c9 commit 8aaf5ca

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ tcRnModule hsc_env keep_lbls pmod = do
221221
HsParsedModule { hpm_module = parsedSource pmod,
222222
hpm_src_files = pm_extra_src_files pmod,
223223
hpm_annotations = pm_annotations pmod }
224-
let rn_info = case mrn_info of
225-
Just x -> x
226-
Nothing -> error "no renamed info tcRnModule"
224+
let rn_info = fromMaybe (error "no renamed info tcRnModule") mrn_info
227225
pure (TcModuleResult pmod rn_info tc_gbl_env splices False)
228226

229227
mkHiFileResultNoCompile :: HscEnv -> TcModuleResult -> IO HiFileResult
@@ -1026,6 +1024,7 @@ getDocsBatch
10261024
-> Module -- ^ a moudle where the names are in scope
10271025
-> [Name]
10281026
-> IO (Either ErrorMessages (Map.Map Name (Either GetDocsFailure (Maybe HsDocString, Maybe (Map.Map Int HsDocString)))))
1027+
-- ^ Return a 'Map' of 'Name's to 'Either' (no docs messages) (general doc body & arg docs)
10291028
getDocsBatch hsc_env _mod _names = do
10301029
((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map.fromList <$> traverse findNameInfo _names
10311030
pure $ maybeToEither errs res
@@ -1043,9 +1042,9 @@ getDocsBatch hsc_env _mod _names = do
10431042
<- loadModuleInterface "getModuleInterface" mod
10441043
pure . (name,) $
10451044
if isNothing mb_doc_hdr && Map.null dmap && Map.null amap
1046-
then Left $ NoDocsInIface mod $ compiled name
1045+
then Left $ NoDocsInIface mod $ isCompiled name
10471046
else Right (Map.lookup name dmap, Map.lookup name amap)
1048-
compiled n =
1047+
isCompiled n =
10491048
-- TODO: Find a more direct indicator.
10501049
case nameSrcLoc n of
10511050
RealSrcLoc {} -> False
@@ -1066,7 +1065,7 @@ lookupName hsc_env mod name = do
10661065
tcthing <- tcLookup name
10671066
case tcthing of
10681067
AGlobal thing -> return thing
1069-
ATcId{tct_id=id} -> return (AnId id)
1068+
ATcId{tct_id=id} -> return $ AnId id
10701069
_ -> panic "tcRnLookupName'"
10711070
return res
10721071

0 commit comments

Comments
 (0)