Skip to content

Commit 04a9a14

Browse files
committed
Filter out internal names from Hover Information
This essentially restores the behaviour from before the PR haskell#4392 where we accidentally reintroduced rendering of internal names.
1 parent f09500b commit 04a9a14

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,20 @@ atPoint IdeOptions{} (HAR _ (hf :: HieASTs a) rf _ (kind :: HieKind hietype)) (D
261261
info :: NodeInfo hietype
262262
info = nodeInfoH kind ast
263263

264-
-- We want evidence variables to be displayed last.
265-
-- Evidence trees contain information of secondary relevance.
264+
-- We consider identifiers to be internal, if they are evidence bindings.
265+
isInternal :: (Identifier, IdentifierDetails a) -> Bool
266+
isInternal (Right _, dets) =
267+
any isEvidenceBind $ identInfo dets
268+
isInternal (Left _, _) = False
269+
270+
-- Don't display names we consider internal. They don't render correctly.
266271
names :: [(Identifier, IdentifierDetails hietype)]
267-
names = sortOn (any isEvidenceUse . identInfo . snd) $ M.assocs $ nodeIdentifiers info
272+
names = filter (not . isInternal) unfilteredNames
273+
274+
-- We want evidence use variables to be displayed last.
275+
-- Evidence trees contain information of secondary relevance.
276+
unfilteredNames :: [(Identifier, IdentifierDetails hietype)]
277+
unfilteredNames = sortOn (any isEvidenceUse . identInfo . snd) $ M.assocs $ nodeIdentifiers info
268278

269279
prettyName :: (Either ModuleName Name, IdentifierDetails hietype) -> IO T.Text
270280
prettyName (Right n, dets)

0 commit comments

Comments
 (0)