Skip to content

Commit e240c8d

Browse files
committed
ghcide: Documentation: mkDocsMap: m clean-up
1 parent 5f764ea commit e240c8d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -990,11 +990,12 @@ mkDetailsFromIface session iface linkable = do
990990
initIfaceLoad hsc' (typecheckIface iface)
991991
return (HomeModInfo iface details linkable)
992992

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

9991000
getDocsNonInteractive'
10001001
:: Name

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

Lines changed: 6 additions & 6 deletions
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)