From 178dda2e0aff4cc242095e25415b38df2ed2dc49 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 8 Dec 2024 22:22:47 +0100 Subject: [PATCH 1/4] Expose SymbolKind in hover extensions --- src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs b/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs index bb64e86..121c9a7 100644 --- a/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs +++ b/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs @@ -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", maybe "" (T.pack . show . (.kind)) symbol) ] :: [(T.Text, T.Text)] applyParam p = T.replace ("{" <> p <> "}") evalTemplate t = foldr (uncurry applyParam) t templateParams From b7cf1ce919e451af23b213e53f210b2ec626b5a5 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 8 Dec 2024 22:29:47 +0100 Subject: [PATCH 2/4] Always output a symbol kind --- src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs b/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs index 121c9a7..f620b60 100644 --- a/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs +++ b/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs @@ -87,7 +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", maybe "" (T.pack . show . (.kind)) symbol) + , ("symbolKind", T.pack (show (maybe I.Other (.kind) symbol))) ] :: [(T.Text, T.Text)] applyParam p = T.replace ("{" <> p <> "}") evalTemplate t = foldr (uncurry applyParam) t templateParams From 0da0435702c3823d6b1905f9d23bcfc6531f61a1 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 8 Dec 2024 22:30:16 +0100 Subject: [PATCH 3/4] Rename SymbolKind Other to Unknown --- src/Curry/LanguageServer/Handlers/TextDocument/Completion.hs | 2 +- src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs | 2 +- src/Curry/LanguageServer/Handlers/Workspace/Symbol.hs | 2 +- src/Curry/LanguageServer/Index/Symbol.hs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Curry/LanguageServer/Handlers/TextDocument/Completion.hs b/src/Curry/LanguageServer/Handlers/TextDocument/Completion.hs index b64aafc..e580d19 100644 --- a/src/Curry/LanguageServer/Handlers/TextDocument/Completion.hs +++ b/src/Curry/LanguageServer/Handlers/TextDocument/Completion.hs @@ -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 diff --git a/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs b/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs index f620b60..8280082 100644 --- a/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs +++ b/src/Curry/LanguageServer/Handlers/TextDocument/Hover.hs @@ -87,7 +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.Other (.kind) 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 diff --git a/src/Curry/LanguageServer/Handlers/Workspace/Symbol.hs b/src/Curry/LanguageServer/Handlers/Workspace/Symbol.hs index c1407e2..187a9d7 100644 --- a/src/Curry/LanguageServer/Handlers/Workspace/Symbol.hs +++ b/src/Curry/LanguageServer/Handlers/Workspace/Symbol.hs @@ -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 diff --git a/src/Curry/LanguageServer/Index/Symbol.hs b/src/Curry/LanguageServer/Index/Symbol.hs index f4f3dd4..8e6858f 100644 --- a/src/Curry/LanguageServer/Index/Symbol.hs +++ b/src/Curry/LanguageServer/Index/Symbol.hs @@ -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. @@ -41,7 +41,7 @@ data Symbol = Symbol instance Default Symbol where def = Symbol - { kind = Other + { kind = Unknown , qualIdent = "" , ident = "" , printedType = Nothing From 64004fab6d279be6b890cf9a6bce9dad1afaa843 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 8 Dec 2024 22:30:37 +0100 Subject: [PATCH 4/4] Prefix unused config argument with underscore --- src/Curry/LanguageServer/Handlers/Config.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Curry/LanguageServer/Handlers/Config.hs b/src/Curry/LanguageServer/Handlers/Config.hs index 7802cec..41dd8b0 100644 --- a/src/Curry/LanguageServer/Handlers/Config.hs +++ b/src/Curry/LanguageServer/Handlers/Config.hs @@ -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"