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

deriveJSON lspOptions ''SelectionRange