Skip to content

Commit da06f06

Browse files
committed
ghcide: Documentation: mkDocsMap: m clean-up
1 parent ef51f6a commit da06f06

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -991,11 +991,12 @@ mkDetailsFromIface session iface linkable = do
991991
initIfaceLoad hsc' (typecheckIface iface)
992992
return (HomeModInfo iface details linkable)
993993

994-
fakeSpan :: RealSrcSpan
995-
fakeSpan = realSrcLocSpan $ mkRealSrcLoc (Util.fsLit "<ghcide>") 1 1
996-
997994
initTypecheckEnv :: HscEnv -> Module -> TcRn r -> IO (Messages, Maybe r)
998995
initTypecheckEnv hsc_env mod = initTc hsc_env HsSrcFile False mod fakeSpan
996+
where
997+
fakeSpan :: RealSrcSpan
998+
fakeSpan = realSrcLocSpan $ mkRealSrcLoc (Util.fsLit "<ghcide>") 1 1
999+
9991000

10001001
getDocsNonInteractive'
10011002
:: Name

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ mkDocMap env rm this_mod =
4444
k <- foldrM getType (tcg_type_env this_mod) names
4545
pure $ DKMap d k
4646
where
47-
getDocs n map
48-
| maybe True (mod ==) $ nameModule_maybe n = pure map -- we already have the docs in this_docs, or they do not exist
47+
getDocs n mapToSpanDoc
48+
| maybe True (mod ==) $ nameModule_maybe n = pure mapToSpanDoc -- we already have the docs in this_docs, or they do not exist
4949
| otherwise = do
5050
doc <- getDocumentationTryGhc env mod n
51-
pure $ extendNameEnv map n doc
52-
getType n map
51+
pure $ extendNameEnv mapToSpanDoc n doc
52+
getType n mapToTyThing
5353
| isTcOcc $ occName n = do
5454
kind <- lookupKind env mod n
55-
pure $ maybe map (extendNameEnv map n) kind
56-
| otherwise = pure map
55+
pure $ maybe mapToTyThing (extendNameEnv mapToTyThing n) kind
56+
| otherwise = pure mapToTyThing
5757
names = rights $ S.toList idents
5858
idents = M.keysSet rm
5959
mod = tcg_mod this_mod

0 commit comments

Comments
 (0)