{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE TypeOperators         #-}
{-# LANGUAGE DuplicateRecordFields #-}

module Language.LSP.Types.ServerCapabilities where

import Data.Aeson
import Data.Aeson.TH
import Data.Text (Text)
import Language.LSP.Types.CallHierarchy
import Language.LSP.Types.CodeAction
import Language.LSP.Types.CodeLens
import Language.LSP.Types.Command
import Language.LSP.Types.Common
import Language.LSP.Types.Completion
import Language.LSP.Types.Declaration
import Language.LSP.Types.Definition
import Language.LSP.Types.DocumentColor
import Language.LSP.Types.DocumentHighlight
import Language.LSP.Types.DocumentLink
import Language.LSP.Types.DocumentSymbol
import Language.LSP.Types.FoldingRange
import Language.LSP.Types.Formatting
import Language.LSP.Types.Hover
import Language.LSP.Types.Implementation
import Language.LSP.Types.References
import Language.LSP.Types.Rename
import Language.LSP.Types.SelectionRange
import Language.LSP.Types.SemanticTokens
import Language.LSP.Types.SignatureHelp
import Language.LSP.Types.TextDocument
import Language.LSP.Types.TypeDefinition
import Language.LSP.Types.Utils
import Language.LSP.Types.WorkspaceSymbol

-- ---------------------------------------------------------------------

data WorkspaceFoldersServerCapabilities =
  WorkspaceFoldersServerCapabilities
    { -- | The server has support for workspace folders
      WorkspaceFoldersServerCapabilities -> Maybe Bool
_supported :: Maybe Bool
      -- | Whether the server wants to receive workspace folder
      -- change notifications.
      -- If a strings is provided the string is treated as a ID
      -- under which the notification is registered on the client
      -- side. The ID can be used to unregister for these events
      -- using the `client/unregisterCapability` request.
    , WorkspaceFoldersServerCapabilities -> Maybe (Text |? Bool)
_changeNotifications :: Maybe (Text |? Bool)
    }
  deriving (Int -> WorkspaceFoldersServerCapabilities -> ShowS
[WorkspaceFoldersServerCapabilities] -> ShowS
WorkspaceFoldersServerCapabilities -> String
(Int -> WorkspaceFoldersServerCapabilities -> ShowS)
-> (WorkspaceFoldersServerCapabilities -> String)
-> ([WorkspaceFoldersServerCapabilities] -> ShowS)
-> Show WorkspaceFoldersServerCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceFoldersServerCapabilities] -> ShowS
$cshowList :: [WorkspaceFoldersServerCapabilities] -> ShowS
show :: WorkspaceFoldersServerCapabilities -> String
$cshow :: WorkspaceFoldersServerCapabilities -> String
showsPrec :: Int -> WorkspaceFoldersServerCapabilities -> ShowS
$cshowsPrec :: Int -> WorkspaceFoldersServerCapabilities -> ShowS
Show, ReadPrec [WorkspaceFoldersServerCapabilities]
ReadPrec WorkspaceFoldersServerCapabilities
Int -> ReadS WorkspaceFoldersServerCapabilities
ReadS [WorkspaceFoldersServerCapabilities]
(Int -> ReadS WorkspaceFoldersServerCapabilities)
-> ReadS [WorkspaceFoldersServerCapabilities]
-> ReadPrec WorkspaceFoldersServerCapabilities
-> ReadPrec [WorkspaceFoldersServerCapabilities]
-> Read WorkspaceFoldersServerCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceFoldersServerCapabilities]
$creadListPrec :: ReadPrec [WorkspaceFoldersServerCapabilities]
readPrec :: ReadPrec WorkspaceFoldersServerCapabilities
$creadPrec :: ReadPrec WorkspaceFoldersServerCapabilities
readList :: ReadS [WorkspaceFoldersServerCapabilities]
$creadList :: ReadS [WorkspaceFoldersServerCapabilities]
readsPrec :: Int -> ReadS WorkspaceFoldersServerCapabilities
$creadsPrec :: Int -> ReadS WorkspaceFoldersServerCapabilities
Read, WorkspaceFoldersServerCapabilities
-> WorkspaceFoldersServerCapabilities -> Bool
(WorkspaceFoldersServerCapabilities
 -> WorkspaceFoldersServerCapabilities -> Bool)
-> (WorkspaceFoldersServerCapabilities
    -> WorkspaceFoldersServerCapabilities -> Bool)
-> Eq WorkspaceFoldersServerCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceFoldersServerCapabilities
-> WorkspaceFoldersServerCapabilities -> Bool
$c/= :: WorkspaceFoldersServerCapabilities
-> WorkspaceFoldersServerCapabilities -> Bool
== :: WorkspaceFoldersServerCapabilities
-> WorkspaceFoldersServerCapabilities -> Bool
$c== :: WorkspaceFoldersServerCapabilities
-> WorkspaceFoldersServerCapabilities -> Bool
Eq)

deriveJSON lspOptions ''WorkspaceFoldersServerCapabilities

data WorkspaceServerCapabilities =
  WorkspaceServerCapabilities
    { -- | The server supports workspace folder. Since LSP 3.6
      --
      -- @since 0.7.0.0
      WorkspaceServerCapabilities
-> Maybe WorkspaceFoldersServerCapabilities
_workspaceFolders :: Maybe WorkspaceFoldersServerCapabilities
    }
  deriving (Int -> WorkspaceServerCapabilities -> ShowS
[WorkspaceServerCapabilities] -> ShowS
WorkspaceServerCapabilities -> String
(Int -> WorkspaceServerCapabilities -> ShowS)
-> (WorkspaceServerCapabilities -> String)
-> ([WorkspaceServerCapabilities] -> ShowS)
-> Show WorkspaceServerCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceServerCapabilities] -> ShowS
$cshowList :: [WorkspaceServerCapabilities] -> ShowS
show :: WorkspaceServerCapabilities -> String
$cshow :: WorkspaceServerCapabilities -> String
showsPrec :: Int -> WorkspaceServerCapabilities -> ShowS
$cshowsPrec :: Int -> WorkspaceServerCapabilities -> ShowS
Show, ReadPrec [WorkspaceServerCapabilities]
ReadPrec WorkspaceServerCapabilities
Int -> ReadS WorkspaceServerCapabilities
ReadS [WorkspaceServerCapabilities]
(Int -> ReadS WorkspaceServerCapabilities)
-> ReadS [WorkspaceServerCapabilities]
-> ReadPrec WorkspaceServerCapabilities
-> ReadPrec [WorkspaceServerCapabilities]
-> Read WorkspaceServerCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceServerCapabilities]
$creadListPrec :: ReadPrec [WorkspaceServerCapabilities]
readPrec :: ReadPrec WorkspaceServerCapabilities
$creadPrec :: ReadPrec WorkspaceServerCapabilities
readList :: ReadS [WorkspaceServerCapabilities]
$creadList :: ReadS [WorkspaceServerCapabilities]
readsPrec :: Int -> ReadS WorkspaceServerCapabilities
$creadsPrec :: Int -> ReadS WorkspaceServerCapabilities
Read, WorkspaceServerCapabilities -> WorkspaceServerCapabilities -> Bool
(WorkspaceServerCapabilities
 -> WorkspaceServerCapabilities -> Bool)
-> (WorkspaceServerCapabilities
    -> WorkspaceServerCapabilities -> Bool)
-> Eq WorkspaceServerCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceServerCapabilities -> WorkspaceServerCapabilities -> Bool
$c/= :: WorkspaceServerCapabilities -> WorkspaceServerCapabilities -> Bool
== :: WorkspaceServerCapabilities -> WorkspaceServerCapabilities -> Bool
$c== :: WorkspaceServerCapabilities -> WorkspaceServerCapabilities -> Bool
Eq)
deriveJSON lspOptions ''WorkspaceServerCapabilities

data ServerCapabilities =
  ServerCapabilities
    { -- | Defines how text documents are synced. Is either a detailed structure
      -- defining each notification or for backwards compatibility the
      -- 'TextDocumentSyncKind' number.
      -- If omitted it defaults to 'TdSyncNone'.
      ServerCapabilities
-> Maybe (TextDocumentSyncOptions |? TextDocumentSyncKind)
_textDocumentSync                 :: Maybe (TextDocumentSyncOptions |? TextDocumentSyncKind)
      -- | The server provides hover support.
    , ServerCapabilities -> Maybe (Bool |? HoverOptions)
_hoverProvider                    :: Maybe (Bool |? HoverOptions)
      -- | The server provides completion support.
    , ServerCapabilities -> Maybe CompletionOptions
_completionProvider               :: Maybe CompletionOptions
      -- | The server provides signature help support.
    , ServerCapabilities -> Maybe SignatureHelpOptions
_signatureHelpProvider            :: Maybe SignatureHelpOptions
      -- | The server provides go to declaration support.
      --
      -- Since LSP 3.14.0
    , ServerCapabilities
-> Maybe
     (Bool |? (DeclarationOptions |? DeclarationRegistrationOptions))
_declarationProvider              :: Maybe (Bool |? DeclarationOptions |? DeclarationRegistrationOptions)
      -- | The server provides goto definition support.
    , ServerCapabilities -> Maybe (Bool |? DefinitionOptions)
_definitionProvider               :: Maybe (Bool |? DefinitionOptions)
      -- | The server provides Goto Type Definition support. Since LSP 3.6
      --
      -- @since 0.7.0.0
    , ServerCapabilities
-> Maybe
     (Bool
      |? (TypeDefinitionOptions |? TypeDefinitionRegistrationOptions))
_typeDefinitionProvider           :: Maybe (Bool |? TypeDefinitionOptions |? TypeDefinitionRegistrationOptions)
      -- | The server provides Goto Implementation support. Since LSP 3.6
      --
      -- @since 0.7.0.0
    , ServerCapabilities
-> Maybe
     (Bool
      |? (ImplementationOptions |? ImplementationRegistrationOptions))
_implementationProvider           :: Maybe (Bool |? ImplementationOptions |? ImplementationRegistrationOptions)
      -- | The server provides find references support.
    , ServerCapabilities -> Maybe (Bool |? ReferenceOptions)
_referencesProvider               :: Maybe (Bool |? ReferenceOptions)
      -- | The server provides document highlight support.
    , ServerCapabilities -> Maybe (Bool |? DocumentHighlightOptions)
_documentHighlightProvider        :: Maybe (Bool |? DocumentHighlightOptions)
      -- | The server provides document symbol support.
    , ServerCapabilities -> Maybe (Bool |? DocumentSymbolOptions)
_documentSymbolProvider           :: Maybe (Bool |? DocumentSymbolOptions)
      -- | The server provides code actions.
    , ServerCapabilities -> Maybe (Bool |? CodeActionOptions)
_codeActionProvider               :: Maybe (Bool |? CodeActionOptions)
      -- | The server provides code lens.
    , ServerCapabilities -> Maybe CodeLensOptions
_codeLensProvider                 :: Maybe CodeLensOptions
      -- | The server provides document link support.
    , ServerCapabilities -> Maybe DocumentLinkOptions
_documentLinkProvider             :: Maybe DocumentLinkOptions
      -- | The server provides color provider support. Since LSP 3.6
      --
      -- @since 0.7.0.0
    , ServerCapabilities
-> Maybe
     (Bool
      |? (DocumentColorOptions |? DocumentColorRegistrationOptions))
_colorProvider                    :: Maybe (Bool |? DocumentColorOptions |? DocumentColorRegistrationOptions)
      -- | The server provides document formatting.
    , ServerCapabilities -> Maybe (Bool |? DocumentFormattingOptions)
_documentFormattingProvider       :: Maybe (Bool |? DocumentFormattingOptions)
      -- | The server provides document range formatting.
    , ServerCapabilities
-> Maybe (Bool |? DocumentRangeFormattingOptions)
_documentRangeFormattingProvider  :: Maybe (Bool |? DocumentRangeFormattingOptions)
      -- | The server provides document formatting on typing.
    , ServerCapabilities -> Maybe DocumentOnTypeFormattingOptions
_documentOnTypeFormattingProvider :: Maybe DocumentOnTypeFormattingOptions
      -- | The server provides rename support.
    , ServerCapabilities -> Maybe (Bool |? RenameOptions)
_renameProvider                   :: Maybe (Bool |? RenameOptions)
      -- | The server provides folding provider support. Since LSP 3.10
      --
      -- @since 0.7.0.0
    , ServerCapabilities
-> Maybe
     (Bool |? (FoldingRangeOptions |? FoldingRangeRegistrationOptions))
_foldingRangeProvider             :: Maybe (Bool |? FoldingRangeOptions |? FoldingRangeRegistrationOptions)
      -- | The server provides execute command support.
    , ServerCapabilities -> Maybe ExecuteCommandOptions
_executeCommandProvider           :: Maybe ExecuteCommandOptions
      -- | The server provides selection range support. Since LSP 3.15
    , ServerCapabilities
-> Maybe
     (Bool
      |? (SelectionRangeOptions |? SelectionRangeRegistrationOptions))
_selectionRangeProvider           :: Maybe (Bool |? SelectionRangeOptions |? SelectionRangeRegistrationOptions)
      -- | The server provides call hierarchy support.
    , ServerCapabilities
-> Maybe
     (Bool
      |? (CallHierarchyOptions |? CallHierarchyRegistrationOptions))
_callHierarchyProvider            :: Maybe (Bool |? CallHierarchyOptions |? CallHierarchyRegistrationOptions)
      -- | The server provides semantic tokens support.
      --
      -- @since 3.16.0
    , ServerCapabilities
-> Maybe
     (SemanticTokensOptions |? SemanticTokensRegistrationOptions)
_semanticTokensProvider           :: Maybe (SemanticTokensOptions |? SemanticTokensRegistrationOptions)
      -- | The server provides workspace symbol support.
    , ServerCapabilities -> Maybe (Bool |? WorkspaceSymbolOptions)
_workspaceSymbolProvider          :: Maybe (Bool |? WorkspaceSymbolOptions)
      -- | Workspace specific server capabilities
    , ServerCapabilities -> Maybe WorkspaceServerCapabilities
_workspace                        :: Maybe WorkspaceServerCapabilities
      -- | Experimental server capabilities.
    , ServerCapabilities -> Maybe Value
_experimental                     :: Maybe Value
    } deriving (Int -> ServerCapabilities -> ShowS
[ServerCapabilities] -> ShowS
ServerCapabilities -> String
(Int -> ServerCapabilities -> ShowS)
-> (ServerCapabilities -> String)
-> ([ServerCapabilities] -> ShowS)
-> Show ServerCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerCapabilities] -> ShowS
$cshowList :: [ServerCapabilities] -> ShowS
show :: ServerCapabilities -> String
$cshow :: ServerCapabilities -> String
showsPrec :: Int -> ServerCapabilities -> ShowS
$cshowsPrec :: Int -> ServerCapabilities -> ShowS
Show, ReadPrec [ServerCapabilities]
ReadPrec ServerCapabilities
Int -> ReadS ServerCapabilities
ReadS [ServerCapabilities]
(Int -> ReadS ServerCapabilities)
-> ReadS [ServerCapabilities]
-> ReadPrec ServerCapabilities
-> ReadPrec [ServerCapabilities]
-> Read ServerCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerCapabilities]
$creadListPrec :: ReadPrec [ServerCapabilities]
readPrec :: ReadPrec ServerCapabilities
$creadPrec :: ReadPrec ServerCapabilities
readList :: ReadS [ServerCapabilities]
$creadList :: ReadS [ServerCapabilities]
readsPrec :: Int -> ReadS ServerCapabilities
$creadsPrec :: Int -> ReadS ServerCapabilities
Read, ServerCapabilities -> ServerCapabilities -> Bool
(ServerCapabilities -> ServerCapabilities -> Bool)
-> (ServerCapabilities -> ServerCapabilities -> Bool)
-> Eq ServerCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerCapabilities -> ServerCapabilities -> Bool
$c/= :: ServerCapabilities -> ServerCapabilities -> Bool
== :: ServerCapabilities -> ServerCapabilities -> Bool
$c== :: ServerCapabilities -> ServerCapabilities -> Bool
Eq)

deriveJSON lspOptions ''ServerCapabilities