diff --git a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs index 1e5ec214df..e7e02a48de 100644 --- a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs +++ b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs @@ -415,7 +415,7 @@ localCompletionsForParsedModule uri pm@ParsedModule{pm_parsed_source = L _ HsMod TyClD _ ClassDecl{tcdLName, tcdSigs} -> mkComp tcdLName CiInterface Nothing : [ mkComp id CiFunction (Just $ ppr typ) - | L _ (TypeSig _ ids typ) <- tcdSigs + | L _ (ClassOpSig _ _ ids typ) <- tcdSigs , id <- ids] TyClD _ x -> let generalCompls = [mkComp id cl Nothing diff --git a/ghcide/test/exe/Main.hs b/ghcide/test/exe/Main.hs index a45608829d..d7dda5dbba 100644 --- a/ghcide/test/exe/Main.hs +++ b/ghcide/test/exe/Main.hs @@ -3933,6 +3933,19 @@ localCompletionTests = [ ,("abcdefg", CiFunction, "abcdefg", True, False, Nothing) ,("abcdefgh", CiFunction, "abcdefgh", True, False, Nothing) ,("abcdefghi", CiFunction, "abcdefghi", True, False, Nothing) + ], + completionTest + "class method" + [ + "class Test a where" + , " abcd :: a -> ()" + , " abcde :: a -> Int" + , "instance Test Int where" + , " abcd = abc" + ] + (Position 4 14) + [("abcd", CiFunction, "abcd", True, False, Nothing) + ,("abcde", CiFunction, "abcde", True, False, Nothing) ] ]