{-# LANGUAGE OverloadedStrings #-}
module Language.LSP.Types.Capabilities
  (
    module Language.LSP.Types.ClientCapabilities
  , module Language.LSP.Types.ServerCapabilities
  , module Language.LSP.Types.WorkspaceEdit
  , fullCaps
  , LSPVersion(..)
  , capsForVersion
  ) where

import Prelude hiding (min)
import Language.LSP.Types.ClientCapabilities
import Language.LSP.Types.ServerCapabilities
import Language.LSP.Types.WorkspaceEdit
import Language.LSP.Types

-- | Capabilities for full conformance to the current (v3.15) LSP specification.
fullCaps :: ClientCapabilities
fullCaps :: ClientCapabilities
fullCaps = LSPVersion -> ClientCapabilities
capsForVersion (Int -> Int -> LSPVersion
LSPVersion Int
forall a. Bounded a => a
maxBound Int
forall a. Bounded a => a
maxBound)

-- | A specific version of the LSP specification.
data LSPVersion = LSPVersion Int Int -- ^ Construct a major.minor version

-- | Capabilities for full conformance to the LSP specification up until a version.
-- Some important milestones:
--
-- * 3.12 textDocument/prepareRename request
-- * 3.11 CodeActionOptions provided by the server
-- * 3.10 hierarchical document symbols, folding ranges
-- * 3.9 completion item preselect
-- * 3.8 codeAction literals
-- * 3.7 related information in diagnostics
-- * 3.6 workspace folders, colors, goto type/implementation
-- * 3.4 extended completion item and symbol item kinds
-- * 3.0 dynamic registration
capsForVersion :: LSPVersion -> ClientCapabilities
capsForVersion :: LSPVersion -> ClientCapabilities
capsForVersion (LSPVersion Int
maj Int
min) = Maybe WorkspaceClientCapabilities
-> Maybe TextDocumentClientCapabilities
-> Maybe WindowClientCapabilities
-> Maybe GeneralClientCapabilities
-> Maybe Object
-> ClientCapabilities
ClientCapabilities (WorkspaceClientCapabilities -> Maybe WorkspaceClientCapabilities
forall a. a -> Maybe a
Just WorkspaceClientCapabilities
w) (TextDocumentClientCapabilities
-> Maybe TextDocumentClientCapabilities
forall a. a -> Maybe a
Just TextDocumentClientCapabilities
td) (WindowClientCapabilities -> Maybe WindowClientCapabilities
forall a. a -> Maybe a
Just WindowClientCapabilities
window) (Int
-> Int
-> GeneralClientCapabilities
-> Maybe GeneralClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 GeneralClientCapabilities
general) Maybe Object
forall a. Maybe a
Nothing
  where
    w :: WorkspaceClientCapabilities
w = Maybe Bool
-> Maybe WorkspaceEditClientCapabilities
-> Maybe DidChangeConfigurationClientCapabilities
-> Maybe DidChangeWatchedFilesClientCapabilities
-> Maybe WorkspaceSymbolClientCapabilities
-> Maybe ExecuteCommandClientCapabilities
-> Maybe Bool
-> Maybe Bool
-> Maybe SemanticTokensWorkspaceClientCapabilities
-> WorkspaceClientCapabilities
WorkspaceClientCapabilities
          (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
          (WorkspaceEditClientCapabilities
-> Maybe WorkspaceEditClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool
-> Maybe (List ResourceOperationKind)
-> Maybe FailureHandlingKind
-> Maybe Bool
-> Maybe WorkspaceEditChangeAnnotationClientCapabilities
-> WorkspaceEditClientCapabilities
WorkspaceEditClientCapabilities
                  (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
                  (Int
-> Int
-> List ResourceOperationKind
-> Maybe (List ResourceOperationKind)
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
13 List ResourceOperationKind
resourceOperations)
                  Maybe FailureHandlingKind
forall a. Maybe a
Nothing
                  (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)
                  (Int
-> Int
-> WorkspaceEditChangeAnnotationClientCapabilities
-> Maybe WorkspaceEditChangeAnnotationClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (Maybe Bool -> WorkspaceEditChangeAnnotationClientCapabilities
WorkspaceEditChangeAnnotationClientCapabilities (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)))))
          (DidChangeConfigurationClientCapabilities
-> Maybe DidChangeConfigurationClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DidChangeConfigurationClientCapabilities
DidChangeConfigurationClientCapabilities Maybe Bool
dynamicReg))
          (DidChangeWatchedFilesClientCapabilities
-> Maybe DidChangeWatchedFilesClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DidChangeWatchedFilesClientCapabilities
DidChangeWatchedFilesClientCapabilities Maybe Bool
dynamicReg))
          (WorkspaceSymbolClientCapabilities
-> Maybe WorkspaceSymbolClientCapabilities
forall a. a -> Maybe a
Just WorkspaceSymbolClientCapabilities
symbolCapabilities)
          (ExecuteCommandClientCapabilities
-> Maybe ExecuteCommandClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> ExecuteCommandClientCapabilities
ExecuteCommandClientCapabilities Maybe Bool
dynamicReg))
          (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 Bool
True)
          (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 Bool
True)
          (Int
-> Int
-> SemanticTokensWorkspaceClientCapabilities
-> Maybe SemanticTokensWorkspaceClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (Maybe Bool -> SemanticTokensWorkspaceClientCapabilities
SemanticTokensWorkspaceClientCapabilities (Maybe Bool -> SemanticTokensWorkspaceClientCapabilities)
-> Maybe Bool -> SemanticTokensWorkspaceClientCapabilities
forall a b. (a -> b) -> a -> b
$ Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True))

    resourceOperations :: List ResourceOperationKind
resourceOperations = [ResourceOperationKind] -> List ResourceOperationKind
forall a. [a] -> List a
List
      [ ResourceOperationKind
ResourceOperationCreate
      , ResourceOperationKind
ResourceOperationDelete
      , ResourceOperationKind
ResourceOperationRename
      ]

    symbolCapabilities :: WorkspaceSymbolClientCapabilities
symbolCapabilities = Maybe Bool
-> Maybe WorkspaceSymbolKindClientCapabilities
-> Maybe WorkspaceSymbolTagClientCapabilities
-> WorkspaceSymbolClientCapabilities
WorkspaceSymbolClientCapabilities
      Maybe Bool
dynamicReg
      (Int
-> Int
-> WorkspaceSymbolKindClientCapabilities
-> Maybe WorkspaceSymbolKindClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
4 WorkspaceSymbolKindClientCapabilities
symbolKindCapabilities)
      (Int
-> Int
-> WorkspaceSymbolTagClientCapabilities
-> Maybe WorkspaceSymbolTagClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 WorkspaceSymbolTagClientCapabilities
symbolTagCapabilities)

    symbolKindCapabilities :: WorkspaceSymbolKindClientCapabilities
symbolKindCapabilities =
      Maybe (List SymbolKind) -> WorkspaceSymbolKindClientCapabilities
WorkspaceSymbolKindClientCapabilities (List SymbolKind -> Maybe (List SymbolKind)
forall a. a -> Maybe a
Just List SymbolKind
sKs)

    symbolTagCapabilities :: WorkspaceSymbolTagClientCapabilities
symbolTagCapabilities =
      Maybe (List SymbolTag) -> WorkspaceSymbolTagClientCapabilities
WorkspaceSymbolTagClientCapabilities (List SymbolTag -> Maybe (List SymbolTag)
forall a. a -> Maybe a
Just ([SymbolTag] -> List SymbolTag
forall a. [a] -> List a
List [SymbolTag
StDeprecated]))

    sKs :: List SymbolKind
sKs
      | Int
maj Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
3 Bool -> Bool -> Bool
&& Int
min Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
4 = [SymbolKind] -> List SymbolKind
forall a. [a] -> List a
List ([SymbolKind]
oldSKs [SymbolKind] -> [SymbolKind] -> [SymbolKind]
forall a. [a] -> [a] -> [a]
++ [SymbolKind]
newSKs)
      | Bool
otherwise            = [SymbolKind] -> List SymbolKind
forall a. [a] -> List a
List [SymbolKind]
oldSKs

    oldSKs :: [SymbolKind]
oldSKs =   [ SymbolKind
SkFile
               , SymbolKind
SkModule
               , SymbolKind
SkNamespace
               , SymbolKind
SkPackage
               , SymbolKind
SkClass
               , SymbolKind
SkMethod
               , SymbolKind
SkProperty
               , SymbolKind
SkField
               , SymbolKind
SkConstructor
               , SymbolKind
SkEnum
               , SymbolKind
SkInterface
               , SymbolKind
SkFunction
               , SymbolKind
SkVariable
               , SymbolKind
SkConstant
               , SymbolKind
SkString
               , SymbolKind
SkNumber
               , SymbolKind
SkBoolean
               , SymbolKind
SkArray
               ]

    newSKs :: [SymbolKind]
newSKs = [ SymbolKind
SkObject
             , SymbolKind
SkKey
             , SymbolKind
SkNull
             , SymbolKind
SkEnumMember
             , SymbolKind
SkStruct
             , SymbolKind
SkEvent
             , SymbolKind
SkOperator
             , SymbolKind
SkTypeParameter
             ]

    -- Only one token format for now, just list it here
    tfs :: List TokenFormat
tfs = [TokenFormat] -> List TokenFormat
forall a. [a] -> List a
List [ TokenFormat
TokenFormatRelative ]

    semanticTokensCapabilities :: SemanticTokensClientCapabilities
semanticTokensCapabilities = Maybe Bool
-> SemanticTokensRequestsClientCapabilities
-> List SemanticTokenTypes
-> List SemanticTokenModifiers
-> List TokenFormat
-> Maybe Bool
-> Maybe Bool
-> SemanticTokensClientCapabilities
SemanticTokensClientCapabilities
      (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
      (Maybe SemanticTokensRangeClientCapabilities
-> Maybe SemanticTokensFullClientCapabilities
-> SemanticTokensRequestsClientCapabilities
SemanticTokensRequestsClientCapabilities
       (SemanticTokensRangeClientCapabilities
-> Maybe SemanticTokensRangeClientCapabilities
forall a. a -> Maybe a
Just (SemanticTokensRangeClientCapabilities
 -> Maybe SemanticTokensRangeClientCapabilities)
-> SemanticTokensRangeClientCapabilities
-> Maybe SemanticTokensRangeClientCapabilities
forall a b. (a -> b) -> a -> b
$ Bool -> SemanticTokensRangeClientCapabilities
SemanticTokensRangeBool Bool
True)
       (SemanticTokensFullClientCapabilities
-> Maybe SemanticTokensFullClientCapabilities
forall a. a -> Maybe a
Just (SemanticTokensDeltaClientCapabilities
-> SemanticTokensFullClientCapabilities
SemanticTokensFullDelta (Maybe Bool -> SemanticTokensDeltaClientCapabilities
SemanticTokensDeltaClientCapabilities (Maybe Bool -> SemanticTokensDeltaClientCapabilities)
-> Maybe Bool -> SemanticTokensDeltaClientCapabilities
forall a b. (a -> b) -> a -> b
$ Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True))))
      ([SemanticTokenTypes] -> List SemanticTokenTypes
forall a. [a] -> List a
List [SemanticTokenTypes]
knownSemanticTokenTypes)
      ([SemanticTokenModifiers] -> List SemanticTokenModifiers
forall a. [a] -> List a
List [SemanticTokenModifiers]
knownSemanticTokenModifiers)
      List TokenFormat
tfs
      (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
      (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)

    td :: TextDocumentClientCapabilities
td = Maybe TextDocumentSyncClientCapabilities
-> Maybe CompletionClientCapabilities
-> Maybe HoverClientCapabilities
-> Maybe SignatureHelpClientCapabilities
-> Maybe ReferencesClientCapabilities
-> Maybe DocumentHighlightClientCapabilities
-> Maybe DocumentSymbolClientCapabilities
-> Maybe DocumentFormattingClientCapabilities
-> Maybe DocumentRangeFormattingClientCapabilities
-> Maybe DocumentOnTypeFormattingClientCapabilities
-> Maybe DeclarationClientCapabilities
-> Maybe DefinitionClientCapabilities
-> Maybe TypeDefinitionClientCapabilities
-> Maybe ImplementationClientCapabilities
-> Maybe CodeActionClientCapabilities
-> Maybe CodeLensClientCapabilities
-> Maybe DocumentLinkClientCapabilities
-> Maybe DocumentColorClientCapabilities
-> Maybe RenameClientCapabilities
-> Maybe PublishDiagnosticsClientCapabilities
-> Maybe FoldingRangeClientCapabilities
-> Maybe SelectionRangeClientCapabilities
-> Maybe CallHierarchyClientCapabilities
-> Maybe SemanticTokensClientCapabilities
-> TextDocumentClientCapabilities
TextDocumentClientCapabilities
          (TextDocumentSyncClientCapabilities
-> Maybe TextDocumentSyncClientCapabilities
forall a. a -> Maybe a
Just TextDocumentSyncClientCapabilities
sync)
          (CompletionClientCapabilities -> Maybe CompletionClientCapabilities
forall a. a -> Maybe a
Just CompletionClientCapabilities
completionCapability)
          (HoverClientCapabilities -> Maybe HoverClientCapabilities
forall a. a -> Maybe a
Just HoverClientCapabilities
hoverCapability)
          (SignatureHelpClientCapabilities
-> Maybe SignatureHelpClientCapabilities
forall a. a -> Maybe a
Just SignatureHelpClientCapabilities
signatureHelpCapability)
          (ReferencesClientCapabilities -> Maybe ReferencesClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> ReferencesClientCapabilities
ReferencesClientCapabilities Maybe Bool
dynamicReg))
          (DocumentHighlightClientCapabilities
-> Maybe DocumentHighlightClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DocumentHighlightClientCapabilities
DocumentHighlightClientCapabilities Maybe Bool
dynamicReg))
          (DocumentSymbolClientCapabilities
-> Maybe DocumentSymbolClientCapabilities
forall a. a -> Maybe a
Just DocumentSymbolClientCapabilities
documentSymbolCapability)
          (DocumentFormattingClientCapabilities
-> Maybe DocumentFormattingClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DocumentFormattingClientCapabilities
DocumentFormattingClientCapabilities Maybe Bool
dynamicReg))
          (DocumentRangeFormattingClientCapabilities
-> Maybe DocumentRangeFormattingClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DocumentRangeFormattingClientCapabilities
DocumentRangeFormattingClientCapabilities Maybe Bool
dynamicReg))
          (DocumentOnTypeFormattingClientCapabilities
-> Maybe DocumentOnTypeFormattingClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DocumentOnTypeFormattingClientCapabilities
DocumentOnTypeFormattingClientCapabilities Maybe Bool
dynamicReg))
          (Int
-> Int
-> DeclarationClientCapabilities
-> Maybe DeclarationClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
14 (Maybe Bool -> Maybe Bool -> DeclarationClientCapabilities
DeclarationClientCapabilities Maybe Bool
dynamicReg (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)))
          (DefinitionClientCapabilities -> Maybe DefinitionClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> Maybe Bool -> DefinitionClientCapabilities
DefinitionClientCapabilities Maybe Bool
dynamicReg (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
14 Bool
True)))
          (Int
-> Int
-> TypeDefinitionClientCapabilities
-> Maybe TypeDefinitionClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 (Maybe Bool -> Maybe Bool -> TypeDefinitionClientCapabilities
TypeDefinitionClientCapabilities Maybe Bool
dynamicReg (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
14 Bool
True)))
          (Int
-> Int
-> ImplementationClientCapabilities
-> Maybe ImplementationClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 (Maybe Bool -> Maybe Bool -> ImplementationClientCapabilities
ImplementationClientCapabilities Maybe Bool
dynamicReg (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
14 Bool
True)))
          (CodeActionClientCapabilities -> Maybe CodeActionClientCapabilities
forall a. a -> Maybe a
Just CodeActionClientCapabilities
codeActionCapability)
          (CodeLensClientCapabilities -> Maybe CodeLensClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> CodeLensClientCapabilities
CodeLensClientCapabilities Maybe Bool
dynamicReg))
          (DocumentLinkClientCapabilities
-> Maybe DocumentLinkClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> Maybe Bool -> DocumentLinkClientCapabilities
DocumentLinkClientCapabilities Maybe Bool
dynamicReg (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 Bool
True)))
          (Int
-> Int
-> DocumentColorClientCapabilities
-> Maybe DocumentColorClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 (Maybe Bool -> DocumentColorClientCapabilities
DocumentColorClientCapabilities Maybe Bool
dynamicReg))
          (RenameClientCapabilities -> Maybe RenameClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool
-> Maybe Bool
-> Maybe PrepareSupportDefaultBehavior
-> Maybe Bool
-> RenameClientCapabilities
RenameClientCapabilities Maybe Bool
dynamicReg (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
12 Bool
True) (Int
-> Int
-> PrepareSupportDefaultBehavior
-> Maybe PrepareSupportDefaultBehavior
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 PrepareSupportDefaultBehavior
PsIdentifier) (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)))
          (PublishDiagnosticsClientCapabilities
-> Maybe PublishDiagnosticsClientCapabilities
forall a. a -> Maybe a
Just PublishDiagnosticsClientCapabilities
publishDiagnosticsCapabilities)
          (Int
-> Int
-> FoldingRangeClientCapabilities
-> Maybe FoldingRangeClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
10 FoldingRangeClientCapabilities
foldingRangeCapability)
          (Int
-> Int
-> SelectionRangeClientCapabilities
-> Maybe SelectionRangeClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
5 (Maybe Bool -> SelectionRangeClientCapabilities
SelectionRangeClientCapabilities Maybe Bool
dynamicReg))
          (Int
-> Int
-> CallHierarchyClientCapabilities
-> Maybe CallHierarchyClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (Maybe Bool -> CallHierarchyClientCapabilities
CallHierarchyClientCapabilities Maybe Bool
dynamicReg))
          (Int
-> Int
-> SemanticTokensClientCapabilities
-> Maybe SemanticTokensClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 SemanticTokensClientCapabilities
semanticTokensCapabilities)

    sync :: TextDocumentSyncClientCapabilities
sync =
      Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> TextDocumentSyncClientCapabilities
TextDocumentSyncClientCapabilities
        Maybe Bool
dynamicReg
        (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
        (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
        (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)

    completionCapability :: CompletionClientCapabilities
completionCapability =
      Maybe Bool
-> Maybe CompletionItemClientCapabilities
-> Maybe CompletionItemKindClientCapabilities
-> Maybe Bool
-> CompletionClientCapabilities
CompletionClientCapabilities
        Maybe Bool
dynamicReg
        (CompletionItemClientCapabilities
-> Maybe CompletionItemClientCapabilities
forall a. a -> Maybe a
Just CompletionItemClientCapabilities
completionItemCapabilities)
        (Int
-> Int
-> CompletionItemKindClientCapabilities
-> Maybe CompletionItemKindClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
4 CompletionItemKindClientCapabilities
completionItemKindCapabilities)
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
3 Bool
True)

    completionItemCapabilities :: CompletionItemClientCapabilities
completionItemCapabilities = Maybe Bool
-> Maybe Bool
-> Maybe (List MarkupKind)
-> Maybe Bool
-> Maybe Bool
-> Maybe CompletionItemTagsClientCapabilities
-> Maybe Bool
-> Maybe CompletionItemResolveClientCapabilities
-> Maybe CompletionItemInsertTextModeClientCapabilities
-> CompletionItemClientCapabilities
CompletionItemClientCapabilities
      (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
      (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
      (Int -> Int -> List MarkupKind -> Maybe (List MarkupKind)
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
3 ([MarkupKind] -> List MarkupKind
forall a. [a] -> List a
List [MarkupKind
MkPlainText, MarkupKind
MkMarkdown]))
      (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)
      (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
9 Bool
True)
      (Int
-> Int
-> CompletionItemTagsClientCapabilities
-> Maybe CompletionItemTagsClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 CompletionItemTagsClientCapabilities
completionItemTagsCapabilities)
      (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)
      (Int
-> Int
-> CompletionItemResolveClientCapabilities
-> Maybe CompletionItemResolveClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (List Text -> CompletionItemResolveClientCapabilities
CompletionItemResolveClientCapabilities ([Text] -> List Text
forall a. [a] -> List a
List [Text
"documentation", Text
"details"])))
      (Int
-> Int
-> CompletionItemInsertTextModeClientCapabilities
-> Maybe CompletionItemInsertTextModeClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (List InsertTextMode
-> CompletionItemInsertTextModeClientCapabilities
CompletionItemInsertTextModeClientCapabilities ([InsertTextMode] -> List InsertTextMode
forall a. [a] -> List a
List [])))

    completionItemKindCapabilities :: CompletionItemKindClientCapabilities
completionItemKindCapabilities =
      Maybe (List CompletionItemKind)
-> CompletionItemKindClientCapabilities
CompletionItemKindClientCapabilities (List CompletionItemKind -> Maybe (List CompletionItemKind)
forall a. a -> Maybe a
Just List CompletionItemKind
ciKs)

    completionItemTagsCapabilities :: CompletionItemTagsClientCapabilities
completionItemTagsCapabilities =
      List CompletionItemTag -> CompletionItemTagsClientCapabilities
CompletionItemTagsClientCapabilities ([CompletionItemTag] -> List CompletionItemTag
forall a. [a] -> List a
List [ CompletionItemTag
CitDeprecated ])

    ciKs :: List CompletionItemKind
ciKs
      | Int
maj Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
3 Bool -> Bool -> Bool
&& Int
min Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
4 = [CompletionItemKind] -> List CompletionItemKind
forall a. [a] -> List a
List ([CompletionItemKind]
oldCiKs [CompletionItemKind]
-> [CompletionItemKind] -> [CompletionItemKind]
forall a. [a] -> [a] -> [a]
++ [CompletionItemKind]
newCiKs)
      | Bool
otherwise            = [CompletionItemKind] -> List CompletionItemKind
forall a. [a] -> List a
List [CompletionItemKind]
oldCiKs

    oldCiKs :: [CompletionItemKind]
oldCiKs =   [ CompletionItemKind
CiText
                , CompletionItemKind
CiMethod
                , CompletionItemKind
CiFunction
                , CompletionItemKind
CiConstructor
                , CompletionItemKind
CiField
                , CompletionItemKind
CiVariable
                , CompletionItemKind
CiClass
                , CompletionItemKind
CiInterface
                , CompletionItemKind
CiModule
                , CompletionItemKind
CiProperty
                , CompletionItemKind
CiUnit
                , CompletionItemKind
CiValue
                , CompletionItemKind
CiEnum
                , CompletionItemKind
CiKeyword
                , CompletionItemKind
CiSnippet
                , CompletionItemKind
CiColor
                , CompletionItemKind
CiFile
                , CompletionItemKind
CiReference
                ]

    newCiKs :: [CompletionItemKind]
newCiKs =   [ CompletionItemKind
CiFolder
                , CompletionItemKind
CiEnumMember
                , CompletionItemKind
CiConstant
                , CompletionItemKind
CiStruct
                , CompletionItemKind
CiEvent
                , CompletionItemKind
CiOperator
                , CompletionItemKind
CiTypeParameter
                ]

    hoverCapability :: HoverClientCapabilities
hoverCapability =
      Maybe Bool -> Maybe (List MarkupKind) -> HoverClientCapabilities
HoverClientCapabilities
        Maybe Bool
dynamicReg
        (Int -> Int -> List MarkupKind -> Maybe (List MarkupKind)
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
3 ([MarkupKind] -> List MarkupKind
forall a. [a] -> List a
List [MarkupKind
MkPlainText, MarkupKind
MkMarkdown]))

    codeActionCapability :: CodeActionClientCapabilities
codeActionCapability
      = Maybe Bool
-> Maybe CodeActionLiteralSupport
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe CodeActionResolveClientCapabilities
-> Maybe Bool
-> CodeActionClientCapabilities
CodeActionClientCapabilities
          Maybe Bool
dynamicReg
          (Int
-> Int
-> CodeActionLiteralSupport
-> Maybe CodeActionLiteralSupport
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
8 (CodeActionKindClientCapabilities -> CodeActionLiteralSupport
CodeActionLiteralSupport CodeActionKindClientCapabilities
caKs))
          (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 Bool
True)
          (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)
          (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)
          (Int
-> Int
-> CodeActionResolveClientCapabilities
-> Maybe CodeActionResolveClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (List Text -> CodeActionResolveClientCapabilities
CodeActionResolveClientCapabilities ([Text] -> List Text
forall a. [a] -> List a
List [])))
          (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)
    caKs :: CodeActionKindClientCapabilities
caKs = List CodeActionKind -> CodeActionKindClientCapabilities
CodeActionKindClientCapabilities
              ([CodeActionKind] -> List CodeActionKind
forall a. [a] -> List a
List [CodeActionKind]
specCodeActionKinds)

    signatureHelpCapability :: SignatureHelpClientCapabilities
signatureHelpCapability =
      Maybe Bool
-> Maybe SignatureHelpSignatureInformation
-> Maybe Bool
-> SignatureHelpClientCapabilities
SignatureHelpClientCapabilities
        Maybe Bool
dynamicReg
        (SignatureHelpSignatureInformation
-> Maybe SignatureHelpSignatureInformation
forall a. a -> Maybe a
Just SignatureHelpSignatureInformation
signatureInformationCapability)
        Maybe Bool
forall a. Maybe a
Nothing

    signatureInformationCapability :: SignatureHelpSignatureInformation
signatureInformationCapability =
      Maybe (List MarkupKind)
-> Maybe SignatureHelpParameterInformation
-> Maybe Bool
-> SignatureHelpSignatureInformation
SignatureHelpSignatureInformation
        (List MarkupKind -> Maybe (List MarkupKind)
forall a. a -> Maybe a
Just ([MarkupKind] -> List MarkupKind
forall a. [a] -> List a
List [MarkupKind
MkPlainText, MarkupKind
MkMarkdown]))
        (SignatureHelpParameterInformation
-> Maybe SignatureHelpParameterInformation
forall a. a -> Maybe a
Just SignatureHelpParameterInformation
signatureParameterCapability)
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)

    signatureParameterCapability :: SignatureHelpParameterInformation
signatureParameterCapability =
      Maybe Bool -> SignatureHelpParameterInformation
SignatureHelpParameterInformation (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
14 Bool
True)

    documentSymbolCapability :: DocumentSymbolClientCapabilities
documentSymbolCapability =
      Maybe Bool
-> Maybe DocumentSymbolKindClientCapabilities
-> Maybe Bool
-> Maybe DocumentSymbolTagClientCapabilities
-> Maybe Bool
-> DocumentSymbolClientCapabilities
DocumentSymbolClientCapabilities
        Maybe Bool
dynamicReg
        (Int
-> Int
-> DocumentSymbolKindClientCapabilities
-> Maybe DocumentSymbolKindClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
4 DocumentSymbolKindClientCapabilities
documentSymbolKind)
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
10 Bool
True)
        (Int
-> Int
-> DocumentSymbolTagClientCapabilities
-> Maybe DocumentSymbolTagClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 DocumentSymbolTagClientCapabilities
documentSymbolTag)
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 Bool
True)

    documentSymbolKind :: DocumentSymbolKindClientCapabilities
documentSymbolKind =
      Maybe (List SymbolKind) -> DocumentSymbolKindClientCapabilities
DocumentSymbolKindClientCapabilities
        (List SymbolKind -> Maybe (List SymbolKind)
forall a. a -> Maybe a
Just List SymbolKind
sKs) -- same as workspace symbol kinds

    documentSymbolTag :: DocumentSymbolTagClientCapabilities
documentSymbolTag =
      Maybe (List SymbolTag) -> DocumentSymbolTagClientCapabilities
DocumentSymbolTagClientCapabilities (List SymbolTag -> Maybe (List SymbolTag)
forall a. a -> Maybe a
Just ([SymbolTag] -> List SymbolTag
forall a. [a] -> List a
List [SymbolTag
StDeprecated]))

    foldingRangeCapability :: FoldingRangeClientCapabilities
foldingRangeCapability =
      Maybe Bool
-> Maybe UInt -> Maybe Bool -> FoldingRangeClientCapabilities
FoldingRangeClientCapabilities
        Maybe Bool
dynamicReg
        Maybe UInt
forall a. Maybe a
Nothing
        (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False)

    publishDiagnosticsCapabilities :: PublishDiagnosticsClientCapabilities
publishDiagnosticsCapabilities =
      Maybe Bool
-> Maybe PublishDiagnosticsTagsClientCapabilities
-> Maybe Bool
-> PublishDiagnosticsClientCapabilities
PublishDiagnosticsClientCapabilities
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
7 Bool
True)
        (Int
-> Int
-> PublishDiagnosticsTagsClientCapabilities
-> Maybe PublishDiagnosticsTagsClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 PublishDiagnosticsTagsClientCapabilities
publishDiagnosticsTagsCapabilities)
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 Bool
True)

    publishDiagnosticsTagsCapabilities :: PublishDiagnosticsTagsClientCapabilities
publishDiagnosticsTagsCapabilities =
      List DiagnosticTag -> PublishDiagnosticsTagsClientCapabilities
PublishDiagnosticsTagsClientCapabilities
        ([DiagnosticTag] -> List DiagnosticTag
forall a. [a] -> List a
List [ DiagnosticTag
DtUnnecessary, DiagnosticTag
DtDeprecated ])

    dynamicReg :: Maybe Bool
dynamicReg
      | Int
maj Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
3  = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
      | Bool
otherwise = Maybe Bool
forall a. Maybe a
Nothing
    since :: Int -> Int -> a -> Maybe a
since Int
x Int
y a
a
      | Int
maj Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
x Bool -> Bool -> Bool
&& Int
min Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
y = a -> Maybe a
forall a. a -> Maybe a
Just a
a
      | Bool
otherwise            = Maybe a
forall a. Maybe a
Nothing

    window :: WindowClientCapabilities
window =
      Maybe Bool
-> Maybe ShowMessageRequestClientCapabilities
-> Maybe ShowDocumentClientCapabilities
-> WindowClientCapabilities
WindowClientCapabilities
        (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 Bool
True)
        (Int
-> Int
-> ShowMessageRequestClientCapabilities
-> Maybe ShowMessageRequestClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (ShowMessageRequestClientCapabilities
 -> Maybe ShowMessageRequestClientCapabilities)
-> ShowMessageRequestClientCapabilities
-> Maybe ShowMessageRequestClientCapabilities
forall a b. (a -> b) -> a -> b
$ Maybe MessageActionItemClientCapabilities
-> ShowMessageRequestClientCapabilities
ShowMessageRequestClientCapabilities Maybe MessageActionItemClientCapabilities
forall a. Maybe a
Nothing)
        (Int
-> Int
-> ShowDocumentClientCapabilities
-> Maybe ShowDocumentClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (ShowDocumentClientCapabilities
 -> Maybe ShowDocumentClientCapabilities)
-> ShowDocumentClientCapabilities
-> Maybe ShowDocumentClientCapabilities
forall a b. (a -> b) -> a -> b
$ Bool -> ShowDocumentClientCapabilities
ShowDocumentClientCapabilities Bool
True)

    general :: GeneralClientCapabilities
general = Maybe StaleRequestClientCapabilities
-> Maybe RegularExpressionsClientCapabilities
-> Maybe MarkdownClientCapabilities
-> GeneralClientCapabilities
GeneralClientCapabilities
      (Int
-> Int
-> StaleRequestClientCapabilities
-> Maybe StaleRequestClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (StaleRequestClientCapabilities
 -> Maybe StaleRequestClientCapabilities)
-> StaleRequestClientCapabilities
-> Maybe StaleRequestClientCapabilities
forall a b. (a -> b) -> a -> b
$ Bool -> List Text -> StaleRequestClientCapabilities
StaleRequestClientCapabilities Bool
True ([Text] -> List Text
forall a. [a] -> List a
List []))
      (Int
-> Int
-> RegularExpressionsClientCapabilities
-> Maybe RegularExpressionsClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (RegularExpressionsClientCapabilities
 -> Maybe RegularExpressionsClientCapabilities)
-> RegularExpressionsClientCapabilities
-> Maybe RegularExpressionsClientCapabilities
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Text -> RegularExpressionsClientCapabilities
RegularExpressionsClientCapabilities Text
"" Maybe Text
forall a. Maybe a
Nothing)
      (Int
-> Int
-> MarkdownClientCapabilities
-> Maybe MarkdownClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
16 (MarkdownClientCapabilities -> Maybe MarkdownClientCapabilities)
-> MarkdownClientCapabilities -> Maybe MarkdownClientCapabilities
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Text -> MarkdownClientCapabilities
MarkdownClientCapabilities Text
"" Maybe Text
forall a. Maybe a
Nothing)