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

module Language.LSP.Types.Rename where

import Data.Aeson.TH
import Data.Text (Text)

import Language.LSP.Types.Location
import Language.LSP.Types.TextDocument
import Language.LSP.Types.Progress
import Language.LSP.Types.Utils

data RenameClientCapabilities =
  RenameClientCapabilities
    { -- | Whether rename supports dynamic registration.
      RenameClientCapabilities -> Maybe Bool
_dynamicRegistration :: Maybe Bool
      -- | Client supports testing for validity of rename operations
      -- before execution.
      --
      -- Since LSP 3.12.0
    , RenameClientCapabilities -> Maybe Bool
_prepareSupport :: Maybe Bool
    } deriving (Int -> RenameClientCapabilities -> ShowS
[RenameClientCapabilities] -> ShowS
RenameClientCapabilities -> String
(Int -> RenameClientCapabilities -> ShowS)
-> (RenameClientCapabilities -> String)
-> ([RenameClientCapabilities] -> ShowS)
-> Show RenameClientCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenameClientCapabilities] -> ShowS
$cshowList :: [RenameClientCapabilities] -> ShowS
show :: RenameClientCapabilities -> String
$cshow :: RenameClientCapabilities -> String
showsPrec :: Int -> RenameClientCapabilities -> ShowS
$cshowsPrec :: Int -> RenameClientCapabilities -> ShowS
Show, ReadPrec [RenameClientCapabilities]
ReadPrec RenameClientCapabilities
Int -> ReadS RenameClientCapabilities
ReadS [RenameClientCapabilities]
(Int -> ReadS RenameClientCapabilities)
-> ReadS [RenameClientCapabilities]
-> ReadPrec RenameClientCapabilities
-> ReadPrec [RenameClientCapabilities]
-> Read RenameClientCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenameClientCapabilities]
$creadListPrec :: ReadPrec [RenameClientCapabilities]
readPrec :: ReadPrec RenameClientCapabilities
$creadPrec :: ReadPrec RenameClientCapabilities
readList :: ReadS [RenameClientCapabilities]
$creadList :: ReadS [RenameClientCapabilities]
readsPrec :: Int -> ReadS RenameClientCapabilities
$creadsPrec :: Int -> ReadS RenameClientCapabilities
Read, RenameClientCapabilities -> RenameClientCapabilities -> Bool
(RenameClientCapabilities -> RenameClientCapabilities -> Bool)
-> (RenameClientCapabilities -> RenameClientCapabilities -> Bool)
-> Eq RenameClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
$c/= :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
== :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
$c== :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
Eq)

deriveJSON lspOptions ''RenameClientCapabilities

makeExtendingDatatype "RenameOptions" [''WorkDoneProgressOptions]
  [("_prepareProvider", [t| Maybe Bool |])]
deriveJSON lspOptions ''RenameOptions

makeExtendingDatatype "RenameRegistrationOptions"
  [ ''TextDocumentRegistrationOptions
  , ''RenameOptions
  ] []
deriveJSON lspOptions ''RenameRegistrationOptions

makeExtendingDatatype "RenameParams"
  [ ''TextDocumentPositionParams
  , ''WorkDoneProgressParams
  ]
  [("_newName", [t| Text |])]
deriveJSON lspOptions ''RenameParams

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

makeExtendingDatatype "PrepareRenameParams" [''TextDocumentPositionParams] []
deriveJSON lspOptions ''PrepareRenameParams

data RangeWithPlaceholder =
  RangeWithPlaceholder
  {
    RangeWithPlaceholder -> Range
_range :: Range
  , RangeWithPlaceholder -> Text
_placeholder :: Text
  } deriving RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
(RangeWithPlaceholder -> RangeWithPlaceholder -> Bool)
-> (RangeWithPlaceholder -> RangeWithPlaceholder -> Bool)
-> Eq RangeWithPlaceholder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
$c/= :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
== :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
$c== :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
Eq
deriveJSON lspOptions ''RangeWithPlaceholder