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

Expose SymbolKind in hover extensions #78

Merged
merged 4 commits into from
Dec 8, 2024
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 src/Curry/LanguageServer/Handlers/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import Curry.LanguageServer.Monad (LSM)
import Curry.LanguageServer.Utils.Logging (infoM)

onConfigChange :: Config -> LSM ()
onConfigChange cfg = do
onConfigChange _cfg = do
infoM "Changed configuration"
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ instance ToCompletionItems CompletionSymbol where
I.TypeAlias -> J.CompletionItemKind_Interface
I.TypeClass -> J.CompletionItemKind_Interface
I.TypeVar -> J.CompletionItemKind_Variable
I.Other -> J.CompletionItemKind_Text
I.Unknown -> J.CompletionItemKind_Text
insertText | opts.useSnippets = Just $ makeSnippet name s.printedArgumentTypes
| otherwise = Just name
insertTextFormat | opts.useSnippets = Just J.InsertTextFormat_Snippet
Expand Down
1 change: 1 addition & 0 deletions src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ extensionHover store ast@(moduleIdentifier -> mid) pos@(J.Position l c) uri e =
, ("type", fromMaybe "" ((.printedType) =<< symbol))
, ("identifier", maybe "" (.ident) symbol)
, ("module", maybe "" symbolParentIdent symbol)
, ("symbolKind", T.pack (show (maybe I.Unknown (.kind) symbol)))
] :: [(T.Text, T.Text)]
applyParam p = T.replace ("{" <> p <> "}")
evalTemplate t = foldr (uncurry applyParam) t templateParams
Expand Down
2 changes: 1 addition & 1 deletion src/Curry/LanguageServer/Handlers/Workspace/Symbol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ toWorkspaceSymbol s = J.SymbolInformation name kind tags containerName deprecate
I.TypeAlias -> J.SymbolKind_Interface
I.TypeClass -> J.SymbolKind_Interface
I.TypeVar -> J.SymbolKind_Variable
I.Other -> J.SymbolKind_Namespace
I.Unknown -> J.SymbolKind_Namespace
tags = Nothing
deprecated = Nothing
containerName = Just $ I.symbolParentIdent s
4 changes: 2 additions & 2 deletions src/Curry/LanguageServer/Index/Symbol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data SymbolKind = ValueFunction
| TypeClass
| TypeAlias
| TypeVar
| Other
| Unknown
deriving (Show, Eq)

-- | A module, type or value. If it's a type, the 'printed type' will be the printed kind.
Expand All @@ -41,7 +41,7 @@ data Symbol = Symbol

instance Default Symbol where
def = Symbol
{ kind = Other
{ kind = Unknown
, qualIdent = ""
, ident = ""
, printedType = Nothing
Expand Down
Loading