Skip to content

Commit 4c5081c

Browse files
committed
fixes
1 parent c640f0a commit 4c5081c

File tree

1 file changed

+13
-1
lines changed
  • plugins/hls-class-plugin/src/Ide/Plugin/Class

1 file changed

+13
-1
lines changed

plugins/hls-class-plugin/src/Ide/Plugin/Class/CodeLens.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{-# LANGUAGE GADTs #-}
22
{-# LANGUAGE OverloadedLists #-}
33
{-# LANGUAGE RecordWildCards #-}
4+
{-# LANGUAGE CPP #-}
45
{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
56

67
module Ide.Plugin.Class.CodeLens where
@@ -90,7 +91,18 @@ codeLens state plId CodeLensParams{..} = pluginResponse $ do
9091
getBindSpanWithoutSig ClsInstDecl{..} =
9192
let bindNames = mapMaybe go (bagToList cid_binds)
9293
go (L l bind) = case bind of
93-
FunBind{..} -> Just $ L l fun_id
94+
FunBind{..}
95+
-- `Generated` tagged for Template Haskell,
96+
-- here we filter out nonsence generated bindings
97+
-- that are nonsense for displaying code lenses.
98+
--
99+
-- See https://github.com/haskell/haskell-language-server/issues/3319
100+
#if MIN_VERSION_ghc(9,5,0)
101+
| not $ isGenerated (mg_ext fun_matches)
102+
#else
103+
| not $ isGenerated (mg_origin fun_matches)
104+
#endif
105+
-> Just $ L l fun_id
94106
_ -> Nothing
95107
-- Existed signatures' name
96108
sigNames = concat $ mapMaybe (\(L _ r) -> getSigName r) cid_sigs

0 commit comments

Comments
 (0)