{-# 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
readListPrec :: ReadPrec [PrepareSupportDefaultBehavior]
$creadListPrec :: ReadPrec [PrepareSupportDefaultBehavior]
readPrec :: ReadPrec PrepareSupportDefaultBehavior
$creadPrec :: ReadPrec PrepareSupportDefaultBehavior
readList :: ReadS [PrepareSupportDefaultBehavior]
$creadList :: ReadS [PrepareSupportDefaultBehavior]
readsPrec :: Int -> ReadS PrepareSupportDefaultBehavior
$creadsPrec :: Int -> ReadS 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
showList :: [PrepareSupportDefaultBehavior] -> ShowS
$cshowList :: [PrepareSupportDefaultBehavior] -> ShowS
show :: PrepareSupportDefaultBehavior -> String
$cshow :: PrepareSupportDefaultBehavior -> String
showsPrec :: Int -> PrepareSupportDefaultBehavior -> ShowS
$cshowsPrec :: Int -> PrepareSupportDefaultBehavior -> ShowS
Show, PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
(PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool)
-> (PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool)
-> Eq PrepareSupportDefaultBehavior
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
$c/= :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
== :: PrepareSupportDefaultBehavior
-> PrepareSupportDefaultBehavior -> Bool
$c== :: 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 (f :: * -> *) a. Applicative f => a -> f a
pure PrepareSupportDefaultBehavior
PsIdentifier
parseJSON Value
_ = Parser PrepareSupportDefaultBehavior
forall a. Monoid a => a
mempty
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
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