{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DuplicateRecordFields #-}
module Language.LSP.Types.Rename where
import Data.Aeson
import Data.Aeson.TH
import Data.Text (Text)
import Data.Scientific (Scientific)
import Language.LSP.Types.Location
import Language.LSP.Types.TextDocument
import Language.LSP.Types.Progress
import Language.LSP.Types.Utils
data PrepareSupportDefaultBehavior =
PsIdentifier |
PsUnknown Scientific
deriving (ReadPrec [PrepareSupportDefaultBehavior]
ReadPrec PrepareSupportDefaultBehavior
Int -> ReadS PrepareSupportDefaultBehavior
ReadS [PrepareSupportDefaultBehavior]
(Int -> ReadS PrepareSupportDefaultBehavior)
-> ReadS [PrepareSupportDefaultBehavior]
-> ReadPrec PrepareSupportDefaultBehavior
-> ReadPrec [PrepareSupportDefaultBehavior]
-> Read PrepareSupportDefaultBehavior
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS PrepareSupportDefaultBehavior
readsPrec :: Int -> ReadS PrepareSupportDefaultBehavior
$creadList :: ReadS [PrepareSupportDefaultBehavior]
readList :: ReadS [PrepareSupportDefaultBehavior]
$creadPrec :: ReadPrec PrepareSupportDefaultBehavior
readPrec :: ReadPrec PrepareSupportDefaultBehavior
$creadListPrec :: ReadPrec [PrepareSupportDefaultBehavior]
readListPrec :: ReadPrec [PrepareSupportDefaultBehavior]
Read, Int -> PrepareSupportDefaultBehavior -> ShowS
[PrepareSupportDefaultBehavior] -> ShowS
PrepareSupportDefaultBehavior -> String
(Int -> PrepareSupportDefaultBehavior -> ShowS)
-> (PrepareSupportDefaultBehavior -> String)
-> ([PrepareSupportDefaultBehavior] -> ShowS)
-> Show PrepareSupportDefaultBehavior
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrepareSupportDefaultBehavior -> ShowS
showsPrec :: Int -> PrepareSupportDefaultBehavior -> ShowS
$cshow :: PrepareSupportDefaultBehavior -> String
show :: PrepareSupportDefaultBehavior -> String
$cshowList :: [PrepareSupportDefaultBehavior] -> ShowS
showList :: [PrepareSupportDefaultBehavior] -> ShowS
Show, PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
(PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool)
-> (PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool)
-> Eq PrepareSupportDefaultBehavior
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
== :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
$c/= :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
/= :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
Eq)
instance ToJSON PrepareSupportDefaultBehavior where
toJSON :: PrepareSupportDefaultBehavior -> Value
toJSON PrepareSupportDefaultBehavior
PsIdentifier = Scientific -> Value
Number Scientific
1
toJSON (PsUnknown Scientific
i) = Scientific -> Value
Number Scientific
i
instance FromJSON PrepareSupportDefaultBehavior where
parseJSON :: Value -> Parser PrepareSupportDefaultBehavior
parseJSON (Number Scientific
1) = PrepareSupportDefaultBehavior
-> Parser PrepareSupportDefaultBehavior
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PrepareSupportDefaultBehavior
PsIdentifier
parseJSON Value
_ = String -> Parser PrepareSupportDefaultBehavior
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"PrepareSupportDefaultBehavior"
data RenameClientCapabilities =
RenameClientCapabilities
{
RenameClientCapabilities -> Maybe Bool
_dynamicRegistration :: Maybe Bool
, RenameClientCapabilities -> Maybe Bool
_prepareSupport :: Maybe Bool
, RenameClientCapabilities -> Maybe PrepareSupportDefaultBehavior
prepareSupportDefaultBehavior :: Maybe PrepareSupportDefaultBehavior
, RenameClientCapabilities -> Maybe Bool
honorsChangeAnnotations :: 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
$cshowsPrec :: Int -> RenameClientCapabilities -> ShowS
showsPrec :: Int -> RenameClientCapabilities -> ShowS
$cshow :: RenameClientCapabilities -> String
show :: RenameClientCapabilities -> String
$cshowList :: [RenameClientCapabilities] -> ShowS
showList :: [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
$creadsPrec :: Int -> ReadS RenameClientCapabilities
readsPrec :: Int -> ReadS RenameClientCapabilities
$creadList :: ReadS [RenameClientCapabilities]
readList :: ReadS [RenameClientCapabilities]
$creadPrec :: ReadPrec RenameClientCapabilities
readPrec :: ReadPrec RenameClientCapabilities
$creadListPrec :: ReadPrec [RenameClientCapabilities]
readListPrec :: ReadPrec [RenameClientCapabilities]
Read, RenameClientCapabilities -> RenameClientCapabilities -> Bool
(RenameClientCapabilities -> RenameClientCapabilities -> Bool)
-> (RenameClientCapabilities -> RenameClientCapabilities -> Bool)
-> Eq RenameClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
== :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
$c/= :: RenameClientCapabilities -> RenameClientCapabilities -> Bool
/= :: 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
$c== :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
== :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
$c/= :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
/= :: RangeWithPlaceholder -> RangeWithPlaceholder -> Bool
Eq
deriveJSON lspOptions ''RangeWithPlaceholder