Skip to content

Commit aef0997

Browse files
committed
ghcide: Core.Compile: getDocsBatch: add doc
1 parent 0a59cd0 commit aef0997

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
@@ -208,9 +208,7 @@ tcRnModule hsc_env keep_lbls pmod = do
208208
HsParsedModule { hpm_module = parsedSource pmod,
209209
hpm_src_files = pm_extra_src_files pmod,
210210
hpm_annotations = pm_annotations pmod }
211-
let rn_info = case mrn_info of
212-
Just x -> x
213-
Nothing -> error "no renamed info tcRnModule"
211+
let rn_info = fromMaybe (error "no renamed info tcRnModule") mrn_info
214212
pure (TcModuleResult pmod rn_info tc_gbl_env splices False)
215213

216214
mkHiFileResultNoCompile :: HscEnv -> TcModuleResult -> IO HiFileResult
@@ -966,6 +964,7 @@ getDocsBatch
966964
-> Module -- ^ a moudle where the names are in scope
967965
-> [Name]
968966
-> IO (Either ErrorMessages (Map.Map Name (Either GetDocsFailure (Maybe HsDocString, Maybe (Map.Map Int HsDocString)))))
967+
-- ^ Return a 'Map' of 'Name's to 'Either' (no docs messages) (general doc body & arg docs)
969968
getDocsBatch hsc_env _mod _names = do
970969
((_warns,errs), res) <- initTc hsc_env HsSrcFile False _mod fakeSpan $ Map.fromList <$> traverse findNameInfo _names
971970
pure $ maybeToEither errs res
@@ -983,9 +982,9 @@ getDocsBatch hsc_env _mod _names = do
983982
<- loadModuleInterface "getModuleInterface" mod
984983
pure . (name,) $
985984
if isNothing mb_doc_hdr && Map.null dmap && Map.null amap
986-
then Left $ NoDocsInIface mod $ compiled name
985+
then Left $ NoDocsInIface mod $ isCompiled name
987986
else Right (Map.lookup name dmap, Map.lookup name amap)
988-
compiled n =
987+
isCompiled n =
989988
-- TODO: Find a more direct indicator.
990989
case nameSrcLoc n of
991990
RealSrcLoc {} -> False
@@ -1006,7 +1005,7 @@ lookupName hsc_env mod name = do
10061005
tcthing <- tcLookup name
10071006
case tcthing of
10081007
AGlobal thing -> return thing
1009-
ATcId{tct_id=id} -> return (AnId id)
1008+
ATcId{tct_id=id} -> return $ AnId id
10101009
_ -> panic "tcRnLookupName'"
10111010
return res
10121011

0 commit comments

Comments
 (0)