Skip to content

Commit 035019d

Browse files
authored
Fix spaninfo Haddocks for local modules (#678)
* Fix regression in SpanInfo haddocks for local modules The regression was introduced in #630. I added `GhcSessionDeps` with the idea of reusing the typecheck GHC session for computing the SpanInfo, instead of rebuilding it from scratch. But I forgot to actually reuse it, or maybe the change got lost during the merge. * Add test
1 parent cdfc4b6 commit 035019d

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

src/Development/IDE/Core/Rules.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ getSpanInfoRule :: Rules ()
468468
getSpanInfoRule =
469469
define $ \GetSpanInfo file -> do
470470
tc <- use_ TypeCheck file
471-
packageState <- hscEnv <$> use_ GhcSession file
471+
packageState <- hscEnv <$> use_ GhcSessionDeps file
472472

473473
-- When possible, rely on the haddocks embedded in our interface files
474474
-- This creates problems on ghc-lib, see comment on 'getDocumentationTryGhc'

test/data/hover/Bar.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module Bar (Bar(..)) where
22

3+
-- | Bar Haddock
34
data Bar = Bar

test/data/hover/Foo.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ module Foo (Bar, foo) where
22

33
import Bar
44

5-
foo = Bar
5+
-- | foo Haddock
6+
foo = Bar

test/exe/Main.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,8 +1649,13 @@ findDefinitionAndHoverTests = let
16491649
lstL43 = Position 47 12 ; litL = [ExpectHoverText ["[8391 :: Int, 6268]"]]
16501650
outL45 = Position 49 3 ; outSig = [ExpectHoverText ["outer", "Bool"], mkR 46 0 46 5]
16511651
innL48 = Position 52 5 ; innSig = [ExpectHoverText ["inner", "Char"], mkR 49 2 49 7]
1652-
imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo"], mkL foo 4 0 4 3]
1653-
reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar"], mkL bar 2 0 2 14]
1652+
#if MIN_GHC_API_VERSION(8,6,0)
1653+
imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo", "Haddock"], mkL foo 5 0 5 3]
1654+
reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], mkL bar 3 0 3 14]
1655+
#else
1656+
imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo"], mkL foo 5 0 5 3]
1657+
reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar"], mkL bar 3 0 3 14]
1658+
#endif
16541659
in
16551660
mkFindTests
16561661
-- def hover look expect

0 commit comments

Comments
 (0)