Skip to content

Commit cf69ce5

Browse files
author
DeviousStoat
committed
Avoid creating an empty section if no instances are found
1 parent cdefac2 commit cf69ce5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ atPoint IdeOptions{} (HAR _ hf _ _ (kind :: HieKind hietype)) (DKMap dm km) env
316316
instancesForName :: IO (Maybe [ClsInst])
317317
instancesForName = runMaybeT $ do
318318
typ <- MaybeT . pure $ lookupNameEnv km n >>= tyThingAsDataType
319-
liftIO $ evalGhcEnv env $ getInstancesForType typ
319+
clsInst <- liftIO $ evalGhcEnv env $ getInstancesForType typ
320+
-- Avoid creating an empty wrapped section if no instances are found
321+
guard $ not $ null clsInst
322+
return clsInst
320323

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

0 commit comments

Comments
 (0)