{-# 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenameParams] -> ShowS
$cshowList :: [RenameParams] -> ShowS
show :: RenameParams -> String
$cshow :: RenameParams -> String
showsPrec :: Int -> RenameParams -> ShowS
$cshowsPrec :: Int -> RenameParams -> ShowS
Show, RenameParams -> RenameParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenameParams -> RenameParams -> Bool
$c/= :: RenameParams -> RenameParams -> Bool
== :: RenameParams -> RenameParams -> Bool
$c== :: RenameParams -> RenameParams -> Bool
Eq, Eq 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
min :: RenameParams -> RenameParams -> RenameParams
$cmin :: RenameParams -> RenameParams -> RenameParams
max :: RenameParams -> RenameParams -> RenameParams
$cmax :: RenameParams -> RenameParams -> RenameParams
>= :: RenameParams -> RenameParams -> Bool
$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
compare :: RenameParams -> RenameParams -> Ordering
$ccompare :: RenameParams -> RenameParams -> Ordering
Ord, 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
$cto :: forall x. Rep RenameParams x -> RenameParams
$cfrom :: forall x. RenameParams -> Rep RenameParams x
Generic)
deriving anyclass (RenameParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: RenameParams -> ()
$crnf :: RenameParams -> ()
NFData, Eq RenameParams
Int -> RenameParams -> Int
RenameParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: RenameParams -> Int
$chash :: RenameParams -> Int
hashWithSalt :: Int -> RenameParams -> Int
$chashWithSalt :: Int -> RenameParams -> Int
Hashable)
deriving forall ann. [RenameParams] -> Doc ann
forall ann. RenameParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [RenameParams] -> Doc ann
$cprettyList :: forall ann. [RenameParams] -> Doc ann
pretty :: forall ann. RenameParams -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ [String
"workDoneToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
,[Key
"textDocument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg1]
,[Key
"position" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Position
arg2]
,[Key
"newName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg3]]
instance Aeson.FromJSON RenameParams where
parseJSON :: Value -> Parser RenameParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"RenameParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> TextDocumentIdentifier -> Position -> Text -> RenameParams
RenameParams forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"workDoneToken" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"position" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"newName"