@@ -32,9 +32,9 @@ import Development.IDE.Core.PositionMapping
3232import Development.IDE.Core.RuleTypes
3333import Development.IDE.GHC.Compat
3434import qualified Development.IDE.GHC.Compat.Util as Util
35+ import Development.IDE.GHC.Util (printOutputable )
3536import Development.IDE.Spans.Common
3637import Development.IDE.Types.Options
37- import Development.IDE.GHC.Util (printOutputable )
3838
3939import Control.Applicative
4040import Control.Monad.Extra
@@ -231,11 +231,14 @@ atPoint IdeOptions{} (HAR _ hf _ _ kind) (DKMap dm km) env pos = listToMaybe $ p
231231 prettyNames = map prettyName names
232232 prettyName (Right n, dets) = T. unlines $
233233 wrapHaskell (printOutputable n <> maybe " " (" :: " <> ) ((prettyType <$> identType dets) <|> maybeKind))
234- : definedAt n
235- ++ maybeToList (prettyPackageName n)
234+ : maybeToList (pretty (definedAt n) (prettyPackageName n))
236235 ++ catMaybes [ T. unlines . spanDocToMarkdown <$> lookupNameEnv dm n
237236 ]
238237 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 "
239242 prettyName (Left m,_) = printOutputable m
240243
241244 prettyPackageName n = do
@@ -255,8 +258,8 @@ atPoint IdeOptions{} (HAR _ hf _ _ kind) (DKMap dm km) env pos = listToMaybe $ p
255258 -- do not show "at <no location info>" and similar messages
256259 -- see the code of 'pprNameDefnLoc' for more information
257260 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) <> " *"
260263
261264typeLocationsAtPoint
262265 :: forall m
0 commit comments