X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest%2FCapabilities.hs;h=9947906c4685a521c818de8a027ac3dc9e079a92;hp=f1237e3131f70e20a4b2d4207e10b7cf55cbc23f;hb=ddad6502d460a9140757ac38da7f59a3d5a3a96c;hpb=5ad934c026bf88521199d1e82aa12fe51626b92f diff --git a/src/Language/Haskell/LSP/Test/Capabilities.hs b/src/Language/Haskell/LSP/Test/Capabilities.hs index f1237e3..9947906 100644 --- a/src/Language/Haskell/LSP/Test/Capabilities.hs +++ b/src/Language/Haskell/LSP/Test/Capabilities.hs @@ -1,11 +1,20 @@ +-- TODO: Move this into haskell-lsp module Language.Haskell.LSP.Test.Capabilities where import Language.Haskell.LSP.Types import Language.Haskell.LSP.Types.Capabilities --- | Capabilities for full conformance to the LSP specification. +-- | Capabilities for full conformance to the current (v3.10) LSP specification. -- The whole shebang. fullCaps :: ClientCapabilities -fullCaps = ClientCapabilities (Just w) (Just td) Nothing +fullCaps = capsForVersion (LSPVersion maxBound maxBound) + +-- | A specific version of the LSP specification. +data LSPVersion = LSPVersion Int -- ^ Major + Int -- ^ Minor + +-- | Capabilities for full conformance to the LSP specification up until a version. +capsForVersion :: LSPVersion -> ClientCapabilities +capsForVersion (LSPVersion maj min) = ClientCapabilities (Just w) (Just td) Nothing where w = WorkspaceClientCapabilities (Just True) @@ -39,7 +48,10 @@ fullCaps = ClientCapabilities (Just w) (Just td) Nothing (Just True) codeAction = CodeActionClientCapabilities (Just True) - (Just (CodeActionLiteralSupport kinds)) + codeActionLiterals + codeActionLiterals + | maj >= 3 && min >= 8 = Just (CodeActionLiteralSupport kinds) + | otherwise = Nothing kinds = CodeActionKindValueSet (List [ CodeActionQuickFix , CodeActionRefactor