Skip to content

Commit

Permalink
fix class method completion (#1741)
Browse files Browse the repository at this point in the history
Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
  • Loading branch information
July541 and pepeiborra authored Apr 17, 2021
1 parent 7dcd1c3 commit eb049c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]
]

Expand Down

0 comments on commit eb049c6

Please sign in to comment.