{-# 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
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

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

deriveJSON lspOptions ''WorkspaceSymbolParams