Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix class method completion #1741

Merged
merged 2 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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