Skip to content

Commit 7d9d5ea

Browse files
committed
ghcide: Documentation: mkDocsMap: m clean-up
1 parent 39ad133 commit 7d9d5ea

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
@@ -1017,11 +1017,12 @@ mkDetailsFromIface session iface linkable = do
10171017
initIfaceLoad hsc' (typecheckIface iface)
10181018
return (HomeModInfo iface details linkable)
10191019

1020-
fakeSpan :: RealSrcSpan
1021-
fakeSpan = realSrcLocSpan $ mkRealSrcLoc (Util.fsLit "<ghcide>") 1 1
1022-
10231020
initTypecheckEnv :: HscEnv -> Module -> TcRn r -> IO (Messages, Maybe r)
10241021
initTypecheckEnv hsc_env mod = initTc hsc_env HsSrcFile False mod fakeSpan
1022+
where
1023+
fakeSpan :: RealSrcSpan
1024+
fakeSpan = realSrcLocSpan $ mkRealSrcLoc (Util.fsLit "<ghcide>") 1 1
1025+
10251026

10261027
getDocsNonInteractive'
10271028
:: Name

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ mkDocMap env rm this_mod =
4949
k <- foldrM getType (tcg_type_env this_mod) names
5050
pure $ DKMap d k
5151
where
52-
getDocs n map
53-
| maybe True (mod ==) $ nameModule_maybe n = pure map -- we already have the docs in this_docs, or they do not exist
52+
getDocs n mapToSpanDoc
53+
| maybe True (mod ==) $ nameModule_maybe n = pure mapToSpanDoc -- we already have the docs in this_docs, or they do not exist
5454
| otherwise = do
5555
doc <- getDocumentationTryGhc env mod n
56-
pure $ extendNameEnv map n doc
57-
getType n map
56+
pure $ extendNameEnv mapToSpanDoc n doc
57+
getType n mapToTyThing
5858
| isTcOcc $ occName n = do
5959
kind <- lookupKind env mod n
60-
pure $ maybe map (extendNameEnv map n) kind
61-
| otherwise = pure map
60+
pure $ maybe mapToTyThing (extendNameEnv mapToTyThing n) kind
61+
| otherwise = pure mapToTyThing
6262
names = rights $ S.toList idents
6363
idents = M.keysSet rm
6464
mod = tcg_mod this_mod

0 commit comments

Comments
 (0)