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

module Language.LSP.Types.SelectionRange where

import Data.Aeson.TH
import Language.LSP.Types.Common
import Language.LSP.Types.Location
import Language.LSP.Types.Progress
import Language.LSP.Types.StaticRegistrationOptions
import Language.LSP.Types.TextDocument
import Language.LSP.Types.Utils

data SelectionRangeClientCapabilities = SelectionRangeClientCapabilities
  { -- | Whether implementation supports dynamic registration for selection range providers. If this is set to 'True'
    -- the client supports the new 'SelectionRangeRegistrationOptions' return value for the corresponding server
    -- capability as well.
    SelectionRangeClientCapabilities -> Maybe Bool
_dynamicRegistration :: Maybe Bool
  }
  deriving (ReadPrec [SelectionRangeClientCapabilities]
ReadPrec SelectionRangeClientCapabilities
Int -> ReadS SelectionRangeClientCapabilities
ReadS [SelectionRangeClientCapabilities]
(Int -> ReadS SelectionRangeClientCapabilities)
-> ReadS [SelectionRangeClientCapabilities]
-> ReadPrec SelectionRangeClientCapabilities
-> ReadPrec [SelectionRangeClientCapabilities]
-> Read SelectionRangeClientCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectionRangeClientCapabilities]
$creadListPrec :: ReadPrec [SelectionRangeClientCapabilities]
readPrec :: ReadPrec SelectionRangeClientCapabilities
$creadPrec :: ReadPrec SelectionRangeClientCapabilities
readList :: ReadS [SelectionRangeClientCapabilities]
$creadList :: ReadS [SelectionRangeClientCapabilities]
readsPrec :: Int -> ReadS SelectionRangeClientCapabilities
$creadsPrec :: Int -> ReadS SelectionRangeClientCapabilities
Read, Int -> SelectionRangeClientCapabilities -> ShowS
[SelectionRangeClientCapabilities] -> ShowS
SelectionRangeClientCapabilities -> String
(Int -> SelectionRangeClientCapabilities -> ShowS)
-> (SelectionRangeClientCapabilities -> String)
-> ([SelectionRangeClientCapabilities] -> ShowS)
-> Show SelectionRangeClientCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectionRangeClientCapabilities] -> ShowS
$cshowList :: [SelectionRangeClientCapabilities] -> ShowS
show :: SelectionRangeClientCapabilities -> String
$cshow :: SelectionRangeClientCapabilities -> String
showsPrec :: Int -> SelectionRangeClientCapabilities -> ShowS
$cshowsPrec :: Int -> SelectionRangeClientCapabilities -> ShowS
Show, SelectionRangeClientCapabilities
-> SelectionRangeClientCapabilities -> Bool
(SelectionRangeClientCapabilities
 -> SelectionRangeClientCapabilities -> Bool)
-> (SelectionRangeClientCapabilities
    -> SelectionRangeClientCapabilities -> Bool)
-> Eq SelectionRangeClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectionRangeClientCapabilities
-> SelectionRangeClientCapabilities -> Bool
$c/= :: SelectionRangeClientCapabilities
-> SelectionRangeClientCapabilities -> Bool
== :: SelectionRangeClientCapabilities
-> SelectionRangeClientCapabilities -> Bool
$c== :: SelectionRangeClientCapabilities
-> SelectionRangeClientCapabilities -> Bool
Eq)

deriveJSON lspOptions ''SelectionRangeClientCapabilities

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

makeExtendingDatatype
  "SelectionRangeRegistrationOptions"
  [ ''SelectionRangeOptions,
    ''TextDocumentRegistrationOptions,
    ''StaticRegistrationOptions
  ]
  []
deriveJSON lspOptions ''SelectionRangeRegistrationOptions

makeExtendingDatatype
  "SelectionRangeParams"
  [ ''WorkDoneProgressParams,
    ''PartialResultParams
  ]
  [ ("_textDocument", [t|TextDocumentIdentifier|]),
    ("_positions", [t|List Position|])
  ]
deriveJSON lspOptions ''SelectionRangeParams

data SelectionRange = SelectionRange
  { -- | The 'range' of this selection range.
    SelectionRange -> Range
_range :: Range,
    -- | The parent selection range containing this range. Therefore @parent.range@ must contain @this.range@.
    SelectionRange -> Maybe SelectionRange
_parent :: Maybe SelectionRange
  }
  deriving (ReadPrec [SelectionRange]
ReadPrec SelectionRange
Int -> ReadS SelectionRange
ReadS [SelectionRange]
(Int -> ReadS SelectionRange)
-> ReadS [SelectionRange]
-> ReadPrec SelectionRange
-> ReadPrec [SelectionRange]
-> Read SelectionRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectionRange]
$creadListPrec :: ReadPrec [SelectionRange]
readPrec :: ReadPrec SelectionRange
$creadPrec :: ReadPrec SelectionRange
readList :: ReadS [SelectionRange]
$creadList :: ReadS [SelectionRange]
readsPrec :: Int -> ReadS SelectionRange
$creadsPrec :: Int -> ReadS SelectionRange
Read, Int -> SelectionRange -> ShowS
[SelectionRange] -> ShowS
SelectionRange -> String
(Int -> SelectionRange -> ShowS)
-> (SelectionRange -> String)
-> ([SelectionRange] -> ShowS)
-> Show SelectionRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectionRange] -> ShowS
$cshowList :: [SelectionRange] -> ShowS
show :: SelectionRange -> String
$cshow :: SelectionRange -> String
showsPrec :: Int -> SelectionRange -> ShowS
$cshowsPrec :: Int -> SelectionRange -> ShowS
Show, SelectionRange -> SelectionRange -> Bool
(SelectionRange -> SelectionRange -> Bool)
-> (SelectionRange -> SelectionRange -> Bool) -> Eq SelectionRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectionRange -> SelectionRange -> Bool
$c/= :: SelectionRange -> SelectionRange -> Bool
== :: SelectionRange -> SelectionRange -> Bool
$c== :: SelectionRange -> SelectionRange -> Bool
Eq)

deriveJSON lspOptions ''SelectionRange