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

Use CiInterface/SkInterface for typeclass symbols #1592

Merged
merged 5 commits into from Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/LSP/Outline.hs
Expand Up @@ -78,7 +78,7 @@ documentSymbolForDecl (L (RealSrcSpan l) (TyClD _ ClassDecl { tcdLName = L _ nam
"" -> ""
t -> " " <> t
)
, _kind = SkClass
, _kind = SkInterface
, _detail = Just "class"
, _children =
Just $ List
Expand Down
6 changes: 3 additions & 3 deletions ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Expand Up @@ -145,7 +145,7 @@ occNameToComKind ty oc
| isTcOcc oc = case ty of
Just t
| "Constraint" `T.isSuffixOf` t
-> CiClass
-> CiInterface
_ -> CiStruct
| isDataOcc oc = CiConstructor
| otherwise = CiVariable
Expand Down Expand Up @@ -406,7 +406,7 @@ localCompletionsForParsedModule uri pm@ParsedModule{pm_parsed_source = L _ HsMod
[mkComp id CiVariable Nothing
| VarPat _ id <- listify (\(_ :: Pat GhcPs) -> True) pat_lhs]
TyClD _ ClassDecl{tcdLName, tcdSigs} ->
mkComp tcdLName CiClass Nothing :
mkComp tcdLName CiInterface Nothing :
[ mkComp id CiFunction (Just $ ppr typ)
| L _ (TypeSig _ ids typ) <- tcdSigs
, id <- ids]
Expand All @@ -428,7 +428,7 @@ localCompletionsForParsedModule uri pm@ParsedModule{pm_parsed_source = L _ HsMod
]

mkComp n ctyp ty =
CI ctyp pn (Right thisModName) ty pn Nothing doc (ctyp `elem` [CiStruct, CiClass]) Nothing
CI ctyp pn (Right thisModName) ty pn Nothing doc (ctyp `elem` [CiStruct, CiInterface]) Nothing
where
pn = ppr n
doc = SpanDocText (getDocumentation [pm] n) (SpanDocUris Nothing Nothing)
Expand Down
6 changes: 3 additions & 3 deletions ghcide/test/exe/Main.hs
Expand Up @@ -3768,7 +3768,7 @@ topLevelCompletionTests = [
"class"
["bar :: Xx", "xxx = ()", "-- | haddock", "class Xxx a"]
(Position 0 9)
[("Xxx", CiClass, "Xxx", False, True, Nothing)],
[("Xxx", CiInterface, "Xxx", False, True, Nothing)],
completionTest
"records"
["data Person = Person { _personName:: String, _personAge:: Int}", "bar = Person { _pers }" ]
Expand Down Expand Up @@ -3862,7 +3862,7 @@ nonLocalCompletionTests =
"type"
["{-# OPTIONS_GHC -Wall #-}", "module A () where", "f :: Bo", "f = True"]
(Position 2 7)
[ ("Bounded", CiClass, "Bounded ${1:*}", True, True, Nothing),
[ ("Bounded", CiInterface, "Bounded ${1:*}", True, True, Nothing),
("Bool", CiStruct, "Bool ", True, True, Nothing)
],
completionTest
Expand Down Expand Up @@ -4304,7 +4304,7 @@ outlineTests = testGroup
(Just $ List cc)
classSymbol name loc cc = DocumentSymbol name
(Just "class")
SkClass
SkInterface
Nothing
loc
loc
Expand Down