packages feed

hls-plugin-api 1.2.0.0 → 1.2.0.1

raw patch · 3 files changed

+20/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hls-plugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name:          hls-plugin-api-version:       1.2.0.0+version:       1.2.0.1 synopsis:      Haskell Language Server API for plugin communication description:   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
src/Ide/Plugin/ConfigUtils.hs view
@@ -86,13 +86,14 @@         -- This function captures ide methods registered by the plugin, and then converts it to kv pairs         handlersToGenericDefaultConfig :: DSum.DSum IdeMethod f -> [A.Pair]         handlersToGenericDefaultConfig (IdeMethod m DSum.:=> _) = case m of-          STextDocumentCodeAction     -> ["codeActionsOn" A..= True]-          STextDocumentCodeLens       -> ["codeLensOn" A..= True]-          STextDocumentRename         -> ["renameOn" A..= True]-          STextDocumentHover          -> ["hoverOn" A..= True]-          STextDocumentDocumentSymbol -> ["symbolsOn" A..= True]-          STextDocumentCompletion     -> ["completionOn" A..= True]-          _                           -> []+          STextDocumentCodeAction           -> ["codeActionsOn" A..= True]+          STextDocumentCodeLens             -> ["codeLensOn" A..= True]+          STextDocumentRename               -> ["renameOn" A..= True]+          STextDocumentHover                -> ["hoverOn" A..= True]+          STextDocumentDocumentSymbol       -> ["symbolsOn" A..= True]+          STextDocumentCompletion           -> ["completionOn" A..= True]+          STextDocumentPrepareCallHierarchy -> ["callHierarchyOn" A..= True]+          _                                 -> []  -- | Generates json schema used in haskell vscode extension -- Similar to 'pluginsToDefaultConfig' but simpler, since schema has a flatten structure@@ -121,6 +122,7 @@           STextDocumentHover -> [withIdPrefix "hoverOn" A..= schemaEntry "hover"]           STextDocumentDocumentSymbol -> [withIdPrefix "symbolsOn" A..= schemaEntry "symbols"]           STextDocumentCompletion -> [withIdPrefix "completionOn" A..= schemaEntry "completions"]+          STextDocumentPrepareCallHierarchy -> [withIdPrefix "callHierarchyOn" A..= schemaEntry "call hierarchy"]           _ -> []         schemaEntry desc =           A.object
src/Ide/Types.hs view
@@ -192,7 +192,16 @@       wasRequested (InR ca)         | Nothing <- _only context = True         | Just (List allowed) <- _only context-        , Just caKind <- ca ^. kind = caKind `elem` allowed+        -- See https://github.com/microsoft/language-server-protocol/issues/970+        -- This is somewhat vague, but due to the hierarchical nature of action kinds, we+        -- should check whether the requested kind is a *prefix* of the action kind.+        -- That means, for example, we will return actions with kinds `quickfix.import` and+        -- `quickfix.somethingElse` if the requested kind is `quickfix`.+        -- TODO: add helpers in `lsp` for handling code action hierarchies+        -- For now we abuse the fact that the JSON representation gives us the hierarchical string.+        , Just caKind <- ca ^. kind+        , String caKindStr <- toJSON caKind =+                any (\k -> k `T.isPrefixOf` caKindStr) [kstr | k <- allowed, let String kstr = toJSON k ]         | otherwise = False  instance PluginMethod TextDocumentCodeLens where