@@ -32,9 +32,9 @@ import Development.IDE.Core.PositionMapping
32
32
import Development.IDE.Core.RuleTypes
33
33
import Development.IDE.GHC.Compat
34
34
import qualified Development.IDE.GHC.Compat.Util as Util
35
+ import Development.IDE.GHC.Util (printOutputable )
35
36
import Development.IDE.Spans.Common
36
37
import Development.IDE.Types.Options
37
- import Development.IDE.GHC.Util (printOutputable )
38
38
39
39
import Control.Applicative
40
40
import Control.Monad.Extra
@@ -231,11 +231,14 @@ atPoint IdeOptions{} (HAR _ hf _ _ kind) (DKMap dm km) env pos = listToMaybe $ p
231
231
prettyNames = map prettyName names
232
232
prettyName (Right n, dets) = T. unlines $
233
233
wrapHaskell (printOutputable n <> maybe " " (" :: " <> ) ((prettyType <$> identType dets) <|> maybeKind))
234
- : definedAt n
235
- ++ maybeToList (prettyPackageName n)
234
+ : maybeToList (pretty (definedAt n) (prettyPackageName n))
236
235
++ catMaybes [ T. unlines . spanDocToMarkdown <$> lookupNameEnv dm n
237
236
]
238
237
where maybeKind = fmap printOutputable $ safeTyThingType =<< lookupNameEnv km n
238
+ pretty Nothing Nothing = Nothing
239
+ pretty (Just define) Nothing = Just $ define <> " \n "
240
+ pretty Nothing (Just pkgName) = Just $ pkgName <> " \n "
241
+ pretty (Just define) (Just pkgName) = Just $ define <> " " <> pkgName <> " \n "
239
242
prettyName (Left m,_) = printOutputable m
240
243
241
244
prettyPackageName n = do
@@ -255,8 +258,8 @@ atPoint IdeOptions{} (HAR _ hf _ _ kind) (DKMap dm km) env pos = listToMaybe $ p
255
258
-- do not show "at <no location info>" and similar messages
256
259
-- see the code of 'pprNameDefnLoc' for more information
257
260
case nameSrcLoc name of
258
- UnhelpfulLoc {} | isInternalName name || isSystemName name -> []
259
- _ -> [ " *Defined " <> printOutputable (pprNameDefnLoc name) <> " *" ]
261
+ UnhelpfulLoc {} | isInternalName name || isSystemName name -> Nothing
262
+ _ -> Just $ " *Defined " <> printOutputable (pprNameDefnLoc name) <> " *"
260
263
261
264
typeLocationsAtPoint
262
265
:: forall m
0 commit comments