Skip to content

Commit

Permalink
Merge pull request #78 from fwcd/extension-symbolkind-param
Browse files Browse the repository at this point in the history
Expose SymbolKind in hover extensions
  • Loading branch information
fwcd authored Dec 8, 2024
2 parents 619a9b4 + 64004fa commit c230297
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
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

0 comments on commit c230297

Please sign in to comment.