Skip to content

Commit 3a834f6

Browse files
committed
Stub out 'getDocumentation' on GHC 9.2 (Requires a reimplementation in terms of in-tree annotations)
1 parent 0a411e2 commit 3a834f6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ mkDocMap
3939
-> TcGblEnv
4040
-> IO DocAndKindMap
4141
mkDocMap env rm this_mod =
42-
do let (_ , DeclDocMap this_docs, _) = extractDocs this_mod
42+
do
43+
#if MIN_VERSION_ghc(9,2,0)
44+
(_ , DeclDocMap this_docs, _) <- extractDocs this_mod
45+
#else
46+
let (_ , DeclDocMap this_docs, _) = extractDocs this_mod
47+
#endif
4348
d <- foldrM getDocs (mkNameEnv $ M.toList $ fmap (`SpanDocString` SpanDocUris Nothing Nothing) this_docs) names
4449
k <- foldrM getType (tcg_type_env this_mod) names
4550
pure $ DKMap d k
@@ -108,7 +113,12 @@ getDocumentation
108113
-- may be edge cases where it is very wrong).
109114
-- TODO : Build a version of GHC exactprint to extract this information
110115
-- more accurately.
116+
-- TODO : Implement this for GHC 9.2 with in-tree annotations
117+
-- (alternatively, just remove it and rely soley on GHC's parsing)
111118
getDocumentation sources targetName = fromMaybe [] $ do
119+
#if MIN_VERSION_ghc(9,2,0)
120+
Nothing
121+
#else
112122
-- Find the module the target is defined in.
113123
targetNameSpan <- realSpan $ getLoc targetName
114124
tc <-
@@ -170,6 +180,7 @@ docHeaders = mapMaybe (\(L _ x) -> wrk x)
170180
then Just $ T.pack s
171181
else Nothing
172182
_ -> Nothing
183+
#endif
173184

174185
-- These are taken from haskell-ide-engine's Haddock plugin
175186

0 commit comments

Comments
 (0)