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

module Language.LSP.Types.WorkspaceSymbol where

import Data.Aeson.TH
import Data.Default
import Language.LSP.Types.Common
import Language.LSP.Types.DocumentSymbol
import Language.LSP.Types.Progress
import Language.LSP.Types.Utils

data WorkspaceSymbolKindClientCapabilities =
  WorkspaceSymbolKindClientCapabilities
   { -- | The symbol kind values the client supports. When this
     -- property exists the client also guarantees that it will
     -- handle values outside its set gracefully and falls back
     -- to a default value when unknown.
     --
     -- If this property is not present the client only supports
     -- the symbol kinds from `File` to `Array` as defined in
     -- the initial version of the protocol.
     WorkspaceSymbolKindClientCapabilities -> Maybe (List SymbolKind)
_valueSet :: Maybe (List SymbolKind)
   } deriving (Int -> WorkspaceSymbolKindClientCapabilities -> ShowS
[WorkspaceSymbolKindClientCapabilities] -> ShowS
WorkspaceSymbolKindClientCapabilities -> String
(Int -> WorkspaceSymbolKindClientCapabilities -> ShowS)
-> (WorkspaceSymbolKindClientCapabilities -> String)
-> ([WorkspaceSymbolKindClientCapabilities] -> ShowS)
-> Show WorkspaceSymbolKindClientCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceSymbolKindClientCapabilities] -> ShowS
$cshowList :: [WorkspaceSymbolKindClientCapabilities] -> ShowS
show :: WorkspaceSymbolKindClientCapabilities -> String
$cshow :: WorkspaceSymbolKindClientCapabilities -> String
showsPrec :: Int -> WorkspaceSymbolKindClientCapabilities -> ShowS
$cshowsPrec :: Int -> WorkspaceSymbolKindClientCapabilities -> ShowS
Show, ReadPrec [WorkspaceSymbolKindClientCapabilities]
ReadPrec WorkspaceSymbolKindClientCapabilities
Int -> ReadS WorkspaceSymbolKindClientCapabilities
ReadS [WorkspaceSymbolKindClientCapabilities]
(Int -> ReadS WorkspaceSymbolKindClientCapabilities)
-> ReadS [WorkspaceSymbolKindClientCapabilities]
-> ReadPrec WorkspaceSymbolKindClientCapabilities
-> ReadPrec [WorkspaceSymbolKindClientCapabilities]
-> Read WorkspaceSymbolKindClientCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceSymbolKindClientCapabilities]
$creadListPrec :: ReadPrec [WorkspaceSymbolKindClientCapabilities]
readPrec :: ReadPrec WorkspaceSymbolKindClientCapabilities
$creadPrec :: ReadPrec WorkspaceSymbolKindClientCapabilities
readList :: ReadS [WorkspaceSymbolKindClientCapabilities]
$creadList :: ReadS [WorkspaceSymbolKindClientCapabilities]
readsPrec :: Int -> ReadS WorkspaceSymbolKindClientCapabilities
$creadsPrec :: Int -> ReadS WorkspaceSymbolKindClientCapabilities
Read, WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
(WorkspaceSymbolKindClientCapabilities
 -> WorkspaceSymbolKindClientCapabilities -> Bool)
-> (WorkspaceSymbolKindClientCapabilities
    -> WorkspaceSymbolKindClientCapabilities -> Bool)
-> Eq WorkspaceSymbolKindClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
$c/= :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
== :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
$c== :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
Eq)

deriveJSON lspOptions ''WorkspaceSymbolKindClientCapabilities

instance Default WorkspaceSymbolKindClientCapabilities where
  def :: WorkspaceSymbolKindClientCapabilities
def = Maybe (List SymbolKind) -> WorkspaceSymbolKindClientCapabilities
WorkspaceSymbolKindClientCapabilities (List SymbolKind -> Maybe (List SymbolKind)
forall a. a -> Maybe a
Just (List SymbolKind -> Maybe (List SymbolKind))
-> List SymbolKind -> Maybe (List SymbolKind)
forall a b. (a -> b) -> a -> b
$ [SymbolKind] -> List SymbolKind
forall a. [a] -> List a
List [SymbolKind]
allKinds)
    where allKinds :: [SymbolKind]
allKinds = [ 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
                     ]

data WorkspaceSymbolClientCapabilities =
  WorkspaceSymbolClientCapabilities
    { WorkspaceSymbolClientCapabilities -> Maybe Bool
_dynamicRegistration :: Maybe Bool -- ^Symbol request supports dynamic
                                         -- registration.
    , WorkspaceSymbolClientCapabilities
-> Maybe WorkspaceSymbolKindClientCapabilities
_symbolKind :: Maybe WorkspaceSymbolKindClientCapabilities -- ^ Specific capabilities for the `SymbolKind`.
    } deriving (Int -> WorkspaceSymbolClientCapabilities -> ShowS
[WorkspaceSymbolClientCapabilities] -> ShowS
WorkspaceSymbolClientCapabilities -> String
(Int -> WorkspaceSymbolClientCapabilities -> ShowS)
-> (WorkspaceSymbolClientCapabilities -> String)
-> ([WorkspaceSymbolClientCapabilities] -> ShowS)
-> Show WorkspaceSymbolClientCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceSymbolClientCapabilities] -> ShowS
$cshowList :: [WorkspaceSymbolClientCapabilities] -> ShowS
show :: WorkspaceSymbolClientCapabilities -> String
$cshow :: WorkspaceSymbolClientCapabilities -> String
showsPrec :: Int -> WorkspaceSymbolClientCapabilities -> ShowS
$cshowsPrec :: Int -> WorkspaceSymbolClientCapabilities -> ShowS
Show, ReadPrec [WorkspaceSymbolClientCapabilities]
ReadPrec WorkspaceSymbolClientCapabilities
Int -> ReadS WorkspaceSymbolClientCapabilities
ReadS [WorkspaceSymbolClientCapabilities]
(Int -> ReadS WorkspaceSymbolClientCapabilities)
-> ReadS [WorkspaceSymbolClientCapabilities]
-> ReadPrec WorkspaceSymbolClientCapabilities
-> ReadPrec [WorkspaceSymbolClientCapabilities]
-> Read WorkspaceSymbolClientCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceSymbolClientCapabilities]
$creadListPrec :: ReadPrec [WorkspaceSymbolClientCapabilities]
readPrec :: ReadPrec WorkspaceSymbolClientCapabilities
$creadPrec :: ReadPrec WorkspaceSymbolClientCapabilities
readList :: ReadS [WorkspaceSymbolClientCapabilities]
$creadList :: ReadS [WorkspaceSymbolClientCapabilities]
readsPrec :: Int -> ReadS WorkspaceSymbolClientCapabilities
$creadsPrec :: Int -> ReadS WorkspaceSymbolClientCapabilities
Read, WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
(WorkspaceSymbolClientCapabilities
 -> WorkspaceSymbolClientCapabilities -> Bool)
-> (WorkspaceSymbolClientCapabilities
    -> WorkspaceSymbolClientCapabilities -> Bool)
-> Eq WorkspaceSymbolClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
$c/= :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
== :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
$c== :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
Eq)

deriveJSON lspOptions ''WorkspaceSymbolClientCapabilities

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

makeExtendingDatatype "WorkspaceSymbolOptions" [''WorkDoneProgressOptions] []
deriveJSON lspOptions ''WorkspaceSymbolOptions

makeExtendingDatatype "WorkspaceSymbolRegistrationOptions"
  [''WorkspaceSymbolOptions] []
deriveJSON lspOptions ''WorkspaceSymbolRegistrationOptions

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

makeExtendingDatatype "WorkspaceSymbolParams"
  [ ''WorkDoneProgressParams
  , ''PartialResultParams
  ]
  [("_query", [t| String |])]

deriveJSON lspOptions ''WorkspaceSymbolParams