module Language.Haskell.LSP.Types.Capabilities
(
module Language.Haskell.LSP.Types.ClientCapabilities
, fullCaps
, LSPVersion(..)
, capsForVersion
) where
import Prelude hiding (min)
import Language.Haskell.LSP.Types.ClientCapabilities
import Language.Haskell.LSP.Types
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)
data LSPVersion = LSPVersion Int Int
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) Maybe WindowClientCapabilities
forall a. Maybe a
Nothing Maybe Object
forall a. Maybe a
Nothing
where
w :: WorkspaceClientCapabilities
w = Maybe Bool
-> Maybe WorkspaceEditClientCapabilities
-> Maybe DidChangeConfigurationClientCapabilities
-> Maybe DidChangeWatchedFilesClientCapabilities
-> Maybe SymbolClientCapabilities
-> Maybe ExecuteClientCapabilities
-> 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 -> WorkspaceEditClientCapabilities
WorkspaceEditClientCapabilities (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))
(SymbolClientCapabilities -> Maybe SymbolClientCapabilities
forall a. a -> Maybe a
Just SymbolClientCapabilities
symbolCapabilities)
(ExecuteClientCapabilities -> Maybe ExecuteClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> ExecuteClientCapabilities
ExecuteClientCapabilities 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)
symbolCapabilities :: SymbolClientCapabilities
symbolCapabilities = Maybe Bool
-> Maybe SymbolKindClientCapabilities -> SymbolClientCapabilities
SymbolClientCapabilities
Maybe Bool
dynamicReg
(Int
-> Int
-> SymbolKindClientCapabilities
-> Maybe SymbolKindClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
4 SymbolKindClientCapabilities
symbolKindCapabilities)
symbolKindCapabilities :: SymbolKindClientCapabilities
symbolKindCapabilities =
Maybe (List SymbolKind) -> SymbolKindClientCapabilities
SymbolKindClientCapabilities (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 SynchronizationTextDocumentClientCapabilities
-> Maybe CompletionClientCapabilities
-> Maybe HoverClientCapabilities
-> Maybe SignatureHelpClientCapabilities
-> Maybe ReferencesClientCapabilities
-> Maybe DocumentHighlightClientCapabilities
-> Maybe DocumentSymbolClientCapabilities
-> Maybe FormattingClientCapabilities
-> Maybe RangeFormattingClientCapabilities
-> Maybe OnTypeFormattingClientCapabilities
-> Maybe DefinitionClientCapabilities
-> Maybe TypeDefinitionClientCapabilities
-> Maybe ImplementationClientCapabilities
-> Maybe CodeActionClientCapabilities
-> Maybe CodeLensClientCapabilities
-> Maybe DocumentLinkClientCapabilities
-> Maybe ColorProviderClientCapabilities
-> Maybe RenameClientCapabilities
-> Maybe PublishDiagnosticsClientCapabilities
-> Maybe FoldingRangeClientCapabilities
-> TextDocumentClientCapabilities
TextDocumentClientCapabilities
(SynchronizationTextDocumentClientCapabilities
-> Maybe SynchronizationTextDocumentClientCapabilities
forall a. a -> Maybe a
Just SynchronizationTextDocumentClientCapabilities
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)
(FormattingClientCapabilities -> Maybe FormattingClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> FormattingClientCapabilities
FormattingClientCapabilities (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True)))
(RangeFormattingClientCapabilities
-> Maybe RangeFormattingClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> RangeFormattingClientCapabilities
RangeFormattingClientCapabilities Maybe Bool
dynamicReg))
(OnTypeFormattingClientCapabilities
-> Maybe OnTypeFormattingClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> OnTypeFormattingClientCapabilities
OnTypeFormattingClientCapabilities Maybe Bool
dynamicReg))
(DefinitionClientCapabilities -> Maybe DefinitionClientCapabilities
forall a. a -> Maybe a
Just (Maybe Bool -> DefinitionClientCapabilities
DefinitionClientCapabilities Maybe Bool
dynamicReg))
(Int
-> Int
-> TypeDefinitionClientCapabilities
-> Maybe TypeDefinitionClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 (Maybe Bool -> TypeDefinitionClientCapabilities
TypeDefinitionClientCapabilities Maybe Bool
dynamicReg))
(Int
-> Int
-> ImplementationClientCapabilities
-> Maybe ImplementationClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 (Maybe Bool -> ImplementationClientCapabilities
ImplementationClientCapabilities Maybe Bool
dynamicReg))
(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 -> DocumentLinkClientCapabilities
DocumentLinkClientCapabilities Maybe Bool
dynamicReg))
(Int
-> Int
-> ColorProviderClientCapabilities
-> Maybe ColorProviderClientCapabilities
forall a. Int -> Int -> a -> Maybe a
since Int
3 Int
6 (Maybe Bool -> ColorProviderClientCapabilities
ColorProviderClientCapabilities 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)
sync :: SynchronizationTextDocumentClientCapabilities
sync =
Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> SynchronizationTextDocumentClientCapabilities
SynchronizationTextDocumentClientCapabilities
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 -> 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))
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 SignatureInformationClientCapabilities
-> SignatureHelpClientCapabilities
SignatureHelpClientCapabilities
Maybe Bool
dynamicReg
(SignatureInformationClientCapabilities
-> Maybe SignatureInformationClientCapabilities
forall a. a -> Maybe a
Just SignatureInformationClientCapabilities
signatureInformationCapability)
signatureInformationCapability :: SignatureInformationClientCapabilities
signatureInformationCapability =
Maybe (List MarkupKind) -> SignatureInformationClientCapabilities
SignatureInformationClientCapabilities
(List MarkupKind -> Maybe (List MarkupKind)
forall a. a -> Maybe a
Just ([MarkupKind] -> List MarkupKind
forall a. [a] -> List a
List [MarkupKind
MkPlainText, MarkupKind
MkMarkdown]))
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)
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
-> 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)
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