Skip to content

Commit cdefac2

Browse files
author
DeviousStoat
committed
prettyInstances takes Name argument
1 parent a67792e commit cdefac2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
220220
hoverInfo :: HieAST hietype -> IO (Maybe Range, [T.Text])
221221
hoverInfo ast = do
222222
prettyNames <- mapM prettyName filteredNames
223-
instances <- catMaybes <$> mapM prettyInstances filteredNames
223+
instances <- catMaybes <$> mapM (either (const $ pure Nothing) prettyInstances . fst) filteredNames
224224
pure (Just range, prettyNames ++ pTypes ++ instances)
225225
where
226226
pTypes :: [T.Text]
@@ -309,8 +309,8 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
309309
UnhelpfulLoc {} | isInternalName name || isSystemName name -> Nothing
310310
_ -> Just $ "*Defined " <> printOutputable (pprNameDefnLoc name) <> "*"
311311

312-
prettyInstances :: (Either ModuleName Name, IdentifierDetails hietype) -> IO (Maybe T.Text)
313-
prettyInstances (Right n, _) =
312+
prettyInstances :: Name -> IO (Maybe T.Text)
313+
prettyInstances n =
314314
fmap (wrapHaskell . T.unlines . fmap printOutputable) <$> instancesForName
315315
where
316316
instancesForName :: IO (Maybe [ClsInst])
@@ -327,7 +327,6 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
327327
PatSynCon _ -> Nothing
328328
RealDataCon dc -> Just $ mkTyConTy $ dataConTyCon dc
329329
tyThingAsDataType (ATyCon tc) = Just $ mkTyConTy tc
330-
prettyInstances (Left _, _) = pure Nothing
331330

332331
typeLocationsAtPoint
333332
:: forall m

0 commit comments

Comments
 (0)