Skip to content

Commit e80d081

Browse files
author
DeviousStoat
committed
prettyInstances takes Name argument
1 parent 1ef4430 commit e80d081

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
@@ -222,7 +222,7 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
222222
hoverInfo :: HieAST hietype -> IO (Maybe Range, [T.Text])
223223
hoverInfo ast = do
224224
prettyNames <- mapM prettyName filteredNames
225-
instances <- catMaybes <$> mapM prettyInstances filteredNames
225+
instances <- catMaybes <$> mapM (either (const $ pure Nothing) prettyInstances . fst) filteredNames
226226
pure (Just range, prettyNames ++ pTypes ++ instances)
227227
where
228228
pTypes :: [T.Text]
@@ -311,8 +311,8 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
311311
UnhelpfulLoc {} | isInternalName name || isSystemName name -> Nothing
312312
_ -> Just $ "*Defined " <> printOutputable (pprNameDefnLoc name) <> "*"
313313

314-
prettyInstances :: (Either ModuleName Name, IdentifierDetails hietype) -> IO (Maybe T.Text)
315-
prettyInstances (Right n, _) =
314+
prettyInstances :: Name -> IO (Maybe T.Text)
315+
prettyInstances n =
316316
fmap (wrapHaskell . T.unlines . fmap printOutputable) <$> instancesForName
317317
where
318318
instancesForName :: IO (Maybe [ClsInst])
@@ -329,7 +329,6 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
329329
PatSynCon _ -> Nothing
330330
RealDataCon dc -> Just $ mkTyConTy $ dataConTyCon dc
331331
tyThingAsDataType (ATyCon tc) = Just $ mkTyConTy tc
332-
prettyInstances (Left _, _) = pure Nothing
333332

334333
typeLocationsAtPoint
335334
:: forall m

0 commit comments

Comments
 (0)