{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.RenameParams where
import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson as Aeson
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Data.Text
import qualified Language.LSP.Protocol.Internal.Types.Position
import qualified Language.LSP.Protocol.Internal.Types.ProgressToken
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier
import qualified Language.LSP.Protocol.Types.Common
data RenameParams = RenameParams
{
RenameParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
,
RenameParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
,
RenameParams -> Position
_position :: Language.LSP.Protocol.Internal.Types.Position.Position
,
RenameParams -> Text
_newName :: Data.Text.Text
}
deriving stock (Int -> RenameParams -> ShowS
[RenameParams] -> ShowS
RenameParams -> String
(Int -> RenameParams -> ShowS)
-> (RenameParams -> String)
-> ([RenameParams] -> ShowS)
-> Show RenameParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RenameParams -> ShowS
showsPrec :: Int -> RenameParams -> ShowS
$cshow :: RenameParams -> String
show :: RenameParams -> String
$cshowList :: [RenameParams] -> ShowS
showList :: [RenameParams] -> ShowS
Show, RenameParams -> RenameParams -> Bool
(RenameParams -> RenameParams -> Bool)
-> (RenameParams -> RenameParams -> Bool) -> Eq RenameParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RenameParams -> RenameParams -> Bool
== :: RenameParams -> RenameParams -> Bool
$c/= :: RenameParams -> RenameParams -> Bool
/= :: RenameParams -> RenameParams -> Bool
Eq, Eq RenameParams
Eq RenameParams =>
(RenameParams -> RenameParams -> Ordering)
-> (RenameParams -> RenameParams -> Bool)
-> (RenameParams -> RenameParams -> Bool)
-> (RenameParams -> RenameParams -> Bool)
-> (RenameParams -> RenameParams -> Bool)
-> (RenameParams -> RenameParams -> RenameParams)
-> (RenameParams -> RenameParams -> RenameParams)
-> Ord RenameParams
RenameParams -> RenameParams -> Bool
RenameParams -> RenameParams -> Ordering
RenameParams -> RenameParams -> RenameParams
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: RenameParams -> RenameParams -> Ordering
compare :: RenameParams -> RenameParams -> Ordering
$c< :: RenameParams -> RenameParams -> Bool
< :: RenameParams -> RenameParams -> Bool
$c<= :: RenameParams -> RenameParams -> Bool
<= :: RenameParams -> RenameParams -> Bool
$c> :: RenameParams -> RenameParams -> Bool
> :: RenameParams -> RenameParams -> Bool
$c>= :: RenameParams -> RenameParams -> Bool
>= :: RenameParams -> RenameParams -> Bool
$cmax :: RenameParams -> RenameParams -> RenameParams
max :: RenameParams -> RenameParams -> RenameParams
$cmin :: RenameParams -> RenameParams -> RenameParams
min :: RenameParams -> RenameParams -> RenameParams
Ord, (forall x. RenameParams -> Rep RenameParams x)
-> (forall x. Rep RenameParams x -> RenameParams)
-> Generic RenameParams
forall x. Rep RenameParams x -> RenameParams
forall x. RenameParams -> Rep RenameParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RenameParams -> Rep RenameParams x
from :: forall x. RenameParams -> Rep RenameParams x
$cto :: forall x. Rep RenameParams x -> RenameParams
to :: forall x. Rep RenameParams x -> RenameParams
Generic)
deriving anyclass (RenameParams -> ()
(RenameParams -> ()) -> NFData RenameParams
forall a. (a -> ()) -> NFData a
$crnf :: RenameParams -> ()
rnf :: RenameParams -> ()
NFData, Eq RenameParams
Eq RenameParams =>
(Int -> RenameParams -> Int)
-> (RenameParams -> Int) -> Hashable RenameParams
Int -> RenameParams -> Int
RenameParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> RenameParams -> Int
hashWithSalt :: Int -> RenameParams -> Int
$chash :: RenameParams -> Int
hash :: RenameParams -> Int
Hashable)
deriving (forall ann. RenameParams -> Doc ann)
-> (forall ann. [RenameParams] -> Doc ann) -> Pretty RenameParams
forall ann. [RenameParams] -> Doc ann
forall ann. RenameParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. RenameParams -> Doc ann
pretty :: forall ann. RenameParams -> Doc ann
$cprettyList :: forall ann. [RenameParams] -> Doc ann
prettyList :: forall ann. [RenameParams] -> Doc ann
Pretty via (ViaJSON RenameParams)
instance Aeson.ToJSON RenameParams where
toJSON :: RenameParams -> Value
toJSON (RenameParams Maybe ProgressToken
arg0 TextDocumentIdentifier
arg1 Position
arg2 Text
arg3) = [Pair] -> Value
Aeson.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Pair]] -> [Pair]) -> [[Pair]] -> [Pair]
forall a b. (a -> b) -> a -> b
$ [String
"workDoneToken" String -> Maybe ProgressToken -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
,[Key
"textDocument" Key -> TextDocumentIdentifier -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg1]
,[Key
"position" Key -> Position -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Position
arg2]
,[Key
"newName" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg3]]
instance Aeson.FromJSON RenameParams where
parseJSON :: Value -> Parser RenameParams
parseJSON = String
-> (Object -> Parser RenameParams) -> Value -> Parser RenameParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"RenameParams" ((Object -> Parser RenameParams) -> Value -> Parser RenameParams)
-> (Object -> Parser RenameParams) -> Value -> Parser RenameParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> TextDocumentIdentifier -> Position -> Text -> RenameParams
RenameParams (Maybe ProgressToken
-> TextDocumentIdentifier -> Position -> Text -> RenameParams)
-> Parser (Maybe ProgressToken)
-> Parser
(TextDocumentIdentifier -> Position -> Text -> RenameParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"workDoneToken" Parser (TextDocumentIdentifier -> Position -> Text -> RenameParams)
-> Parser TextDocumentIdentifier
-> Parser (Position -> Text -> RenameParams)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser TextDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument" Parser (Position -> Text -> RenameParams)
-> Parser Position -> Parser (Text -> RenameParams)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser Position
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"position" Parser (Text -> RenameParams) -> Parser Text -> Parser RenameParams
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"newName"