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 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) 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
-> 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
-> 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))
          (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)
    
    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
-> WorkspaceSymbolClientCapabilities
WorkspaceSymbolClientCapabilities
      Maybe Bool
dynamicReg
      (Int
-> Int
-> WorkspaceSymbolKindClientCapabilities
-> Maybe WorkspaceSymbolKindClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
4 WorkspaceSymbolKindClientCapabilities
symbolKindCapabilities)

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

    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
             ]

    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
-> 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 -> RenameClientCapabilities
RenameClientCapabilities Maybe Bool
dynamicReg (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
12 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))
    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
-> 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)

    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
CtDeprecated ])

    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
-> 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)
    caKs :: CodeActionKindClientCapabilities
caKs = List CodeActionKind -> CodeActionKindClientCapabilities
CodeActionKindClientCapabilities
              ([CodeActionKind] -> List CodeActionKind
forall a. [a] -> List a
List [ CodeActionKind
CodeActionQuickFix
                    , CodeActionKind
CodeActionRefactor
                    , CodeActionKind
CodeActionRefactorExtract
                    , CodeActionKind
CodeActionRefactorInline
                    , CodeActionKind
CodeActionRefactorRewrite
                    , CodeActionKind
CodeActionSource
                    , CodeActionKind
CodeActionSourceOrganizeImports
                    ])

    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
-> 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])) Maybe SignatureHelpParameterInformation
forall a. Maybe a
Nothing

    documentSymbolCapability :: DocumentSymbolClientCapabilities
documentSymbolCapability =
      Maybe Bool
-> Maybe DocumentSymbolKindClientCapabilities
-> 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)

    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

    foldingRangeCapability :: FoldingRangeClientCapabilities
foldingRangeCapability =
      Maybe Bool
-> Maybe Int -> Maybe Bool -> FoldingRangeClientCapabilities
FoldingRangeClientCapabilities
        Maybe Bool
dynamicReg
        Maybe Int
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 -> WindowClientCapabilities
WindowClientCapabilities (Int -> Int -> Bool -> Maybe Bool
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
15 Bool
True)