Skip to content

Commit

Permalink
Avoid creating an empty section if no instances are found
Browse files Browse the repository at this point in the history
  • Loading branch information
DeviousStoat committed Feb 11, 2024
1 parent cdefac2 commit cf69ce5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ghcide/src/Development/IDE/Spans/AtPoint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
instancesForName :: IO (Maybe [ClsInst])
instancesForName = runMaybeT $ do
typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingAsDataType
liftIO $ evalGhcEnv env $ getInstancesForType typ
clsInst <- liftIO $ evalGhcEnv env $ getInstancesForType typ
-- Avoid creating an empty wrapped section if no instances are found
guard $ not $ null clsInst
return clsInst

-- | Gets the datatype `Type` corresponding to a TyThing, if it repressents a datatype or
-- a data constructor.
Expand Down

0 comments on commit cf69ce5

Please sign in to comment.