Skip to content

Commit 677e0e5

Browse files
committed
fixes
1 parent c640f0a commit 677e0e5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,4 @@ if impl(ghc >= 9.5)
137137
semigroupoids:base,
138138
stm-hamt:transformers,
139139
entropy:Cabal,
140-
140+

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)