{-# 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
import Data.Text (Text)

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
$cshowsPrec :: Int -> WorkspaceSymbolKindClientCapabilities -> ShowS
showsPrec :: Int -> WorkspaceSymbolKindClientCapabilities -> ShowS
$cshow :: WorkspaceSymbolKindClientCapabilities -> String
show :: WorkspaceSymbolKindClientCapabilities -> String
$cshowList :: [WorkspaceSymbolKindClientCapabilities] -> ShowS
showList :: [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
$creadsPrec :: Int -> ReadS WorkspaceSymbolKindClientCapabilities
readsPrec :: Int -> ReadS WorkspaceSymbolKindClientCapabilities
$creadList :: ReadS [WorkspaceSymbolKindClientCapabilities]
readList :: ReadS [WorkspaceSymbolKindClientCapabilities]
$creadPrec :: ReadPrec WorkspaceSymbolKindClientCapabilities
readPrec :: ReadPrec WorkspaceSymbolKindClientCapabilities
$creadListPrec :: ReadPrec [WorkspaceSymbolKindClientCapabilities]
readListPrec :: ReadPrec [WorkspaceSymbolKindClientCapabilities]
Read, WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
(WorkspaceSymbolKindClientCapabilities
 -> WorkspaceSymbolKindClientCapabilities -> Bool)
-> (WorkspaceSymbolKindClientCapabilities
    -> WorkspaceSymbolKindClientCapabilities -> Bool)
-> Eq WorkspaceSymbolKindClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
== :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
$c/= :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
/= :: WorkspaceSymbolKindClientCapabilities
-> WorkspaceSymbolKindClientCapabilities -> Bool
Eq)

deriveJSON lspOptions ''WorkspaceSymbolKindClientCapabilities

data WorkspaceSymbolTagClientCapabilities =
  WorkspaceSymbolTagClientCapabilities
    { -- | The tags supported by the client.
      WorkspaceSymbolTagClientCapabilities -> Maybe (List SymbolTag)
_valueSet :: Maybe (List SymbolTag)
    }
  deriving (Int -> WorkspaceSymbolTagClientCapabilities -> ShowS
[WorkspaceSymbolTagClientCapabilities] -> ShowS
WorkspaceSymbolTagClientCapabilities -> String
(Int -> WorkspaceSymbolTagClientCapabilities -> ShowS)
-> (WorkspaceSymbolTagClientCapabilities -> String)
-> ([WorkspaceSymbolTagClientCapabilities] -> ShowS)
-> Show WorkspaceSymbolTagClientCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkspaceSymbolTagClientCapabilities -> ShowS
showsPrec :: Int -> WorkspaceSymbolTagClientCapabilities -> ShowS
$cshow :: WorkspaceSymbolTagClientCapabilities -> String
show :: WorkspaceSymbolTagClientCapabilities -> String
$cshowList :: [WorkspaceSymbolTagClientCapabilities] -> ShowS
showList :: [WorkspaceSymbolTagClientCapabilities] -> ShowS
Show, ReadPrec [WorkspaceSymbolTagClientCapabilities]
ReadPrec WorkspaceSymbolTagClientCapabilities
Int -> ReadS WorkspaceSymbolTagClientCapabilities
ReadS [WorkspaceSymbolTagClientCapabilities]
(Int -> ReadS WorkspaceSymbolTagClientCapabilities)
-> ReadS [WorkspaceSymbolTagClientCapabilities]
-> ReadPrec WorkspaceSymbolTagClientCapabilities
-> ReadPrec [WorkspaceSymbolTagClientCapabilities]
-> Read WorkspaceSymbolTagClientCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS WorkspaceSymbolTagClientCapabilities
readsPrec :: Int -> ReadS WorkspaceSymbolTagClientCapabilities
$creadList :: ReadS [WorkspaceSymbolTagClientCapabilities]
readList :: ReadS [WorkspaceSymbolTagClientCapabilities]
$creadPrec :: ReadPrec WorkspaceSymbolTagClientCapabilities
readPrec :: ReadPrec WorkspaceSymbolTagClientCapabilities
$creadListPrec :: ReadPrec [WorkspaceSymbolTagClientCapabilities]
readListPrec :: ReadPrec [WorkspaceSymbolTagClientCapabilities]
Read, WorkspaceSymbolTagClientCapabilities
-> WorkspaceSymbolTagClientCapabilities -> Bool
(WorkspaceSymbolTagClientCapabilities
 -> WorkspaceSymbolTagClientCapabilities -> Bool)
-> (WorkspaceSymbolTagClientCapabilities
    -> WorkspaceSymbolTagClientCapabilities -> Bool)
-> Eq WorkspaceSymbolTagClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkspaceSymbolTagClientCapabilities
-> WorkspaceSymbolTagClientCapabilities -> Bool
== :: WorkspaceSymbolTagClientCapabilities
-> WorkspaceSymbolTagClientCapabilities -> Bool
$c/= :: WorkspaceSymbolTagClientCapabilities
-> WorkspaceSymbolTagClientCapabilities -> Bool
/= :: WorkspaceSymbolTagClientCapabilities
-> WorkspaceSymbolTagClientCapabilities -> Bool
Eq)

deriveJSON lspOptions ''WorkspaceSymbolTagClientCapabilities

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`.
      -- | The client supports tags on `SymbolInformation`.
      -- Clients supporting tags have to handle unknown tags gracefully.
      --
      -- @since 3.16.0
    , WorkspaceSymbolClientCapabilities
-> Maybe WorkspaceSymbolTagClientCapabilities
_tagSupport :: Maybe WorkspaceSymbolTagClientCapabilities 
    } 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
$cshowsPrec :: Int -> WorkspaceSymbolClientCapabilities -> ShowS
showsPrec :: Int -> WorkspaceSymbolClientCapabilities -> ShowS
$cshow :: WorkspaceSymbolClientCapabilities -> String
show :: WorkspaceSymbolClientCapabilities -> String
$cshowList :: [WorkspaceSymbolClientCapabilities] -> ShowS
showList :: [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
$creadsPrec :: Int -> ReadS WorkspaceSymbolClientCapabilities
readsPrec :: Int -> ReadS WorkspaceSymbolClientCapabilities
$creadList :: ReadS [WorkspaceSymbolClientCapabilities]
readList :: ReadS [WorkspaceSymbolClientCapabilities]
$creadPrec :: ReadPrec WorkspaceSymbolClientCapabilities
readPrec :: ReadPrec WorkspaceSymbolClientCapabilities
$creadListPrec :: ReadPrec [WorkspaceSymbolClientCapabilities]
readListPrec :: ReadPrec [WorkspaceSymbolClientCapabilities]
Read, WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
(WorkspaceSymbolClientCapabilities
 -> WorkspaceSymbolClientCapabilities -> Bool)
-> (WorkspaceSymbolClientCapabilities
    -> WorkspaceSymbolClientCapabilities -> Bool)
-> Eq WorkspaceSymbolClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
== :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
$c/= :: WorkspaceSymbolClientCapabilities
-> WorkspaceSymbolClientCapabilities -> Bool
/= :: 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| Text |])]

deriveJSON lspOptions ''WorkspaceSymbolParams