Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wz1000 committed Mar 22, 2023
1 parent c640f0a commit 677e0e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ if impl(ghc >= 9.5)
semigroupoids:base,
stm-hamt:transformers,
entropy:Cabal,

14 changes: 13 additions & 1 deletion plugins/hls-class-plugin/src/Ide/Plugin/Class/CodeLens.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-overlapping-patterns #-}

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

0 comments on commit 677e0e5

Please sign in to comment.