@@ -41,7 +41,9 @@ import Development.IDE.Core.PositionMapping
4141import Development.IDE.Core.RuleTypes
4242import Development.IDE.GHC.Compat
4343import qualified Development.IDE.GHC.Compat.Util as Util
44- import Development.IDE.GHC.Util (printOutputable ,
44+ import Development.IDE.GHC.Util (getExtensions ,
45+ getExtensionsSet ,
46+ printOutputable ,
4547 printOutputableOneLine )
4648import Development.IDE.Spans.Common
4749import Development.IDE.Types.Options
@@ -69,9 +71,12 @@ import qualified Data.Set as S
6971import Data.Tree
7072import qualified Data.Tree as T
7173import Data.Version (showVersion )
74+ import Debug.Trace (traceShow , traceShowId )
7275import Development.IDE.Core.LookupMod (LookupModule , lookupMod )
76+ import Development.IDE.Core.PluginUtils (runActionE )
7377import Development.IDE.Core.Shake (ShakeExtras (.. ),
74- runIdeAction )
78+ runIdeAction , use ,
79+ useWithStaleFast )
7580import Development.IDE.Types.Shake (WithHieDb )
7681import GHC.Iface.Ext.Types (EvVarSource (.. ),
7782 HieAST (.. ),
@@ -261,8 +266,9 @@ atPoint
261266 -> DocAndTyThingMap
262267 -> HscEnv
263268 -> Position
269+ -> ParsedModule
264270 -> IO (Maybe (Maybe Range , [T. Text ]))
265- atPoint opts@ IdeOptions {} shakeExtras@ ShakeExtras { withHieDb, hiedbWriter } har@ (HAR _ (hf :: HieASTs a ) rf _ (kind :: HieKind hietype )) (DKMap dm km _am) env pos =
271+ atPoint opts@ IdeOptions {} shakeExtras@ ShakeExtras { withHieDb, hiedbWriter } har@ (HAR _ (hf :: HieASTs a ) rf _ (kind :: HieKind hietype )) (DKMap dm km _am) env pos parsedModule =
266272 listToMaybe <$> sequence (pointCommand hf pos hoverInfo)
267273 where
268274 -- Hover info for values/data
@@ -282,6 +288,9 @@ atPoint opts@IdeOptions{} shakeExtras@ShakeExtras{ withHieDb, hiedbWriter } har@
282288 prettyNames <- mapM (prettyName locationsMap) names
283289 pure (Just range, prettyNames ++ pTypes locationsMap)
284290 where
291+ enabledExtensions :: Util. EnumSet Extension
292+ enabledExtensions = getExtensionsSet $ parsedModule
293+
285294 pTypes :: M. Map Name Location -> [T. Text ]
286295 pTypes locationsMap =
287296 case names of
@@ -318,7 +327,7 @@ atPoint opts@IdeOptions{} shakeExtras@ShakeExtras{ withHieDb, hiedbWriter } har@
318327 let
319328 typeSig = case identType dets of
320329 Just t -> prettyType (Just n) locationsMap t
321- Nothing -> case safeTyThingType =<< lookupNameEnv km n of
330+ Nothing -> case safeTyThingType ( Util. member LinearTypes enabledExtensions) =<< lookupNameEnv km n of
322331 Just kind -> prettyTypeFromType (Just n) locationsMap kind
323332 Nothing -> wrapHaskell (printOutputable n)
324333 definitionLoc = maybeToList (pretty (definedAt n) (prettyPackageName n))
0 commit comments