{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.InsertReplaceEdit 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.Range
import qualified Language.LSP.Protocol.Types.Common
data InsertReplaceEdit = InsertReplaceEdit
{
InsertReplaceEdit -> Text
_newText :: Data.Text.Text
,
InsertReplaceEdit -> Range
_insert :: Language.LSP.Protocol.Internal.Types.Range.Range
,
InsertReplaceEdit -> Range
_replace :: Language.LSP.Protocol.Internal.Types.Range.Range
}
deriving stock (Int -> InsertReplaceEdit -> ShowS
[InsertReplaceEdit] -> ShowS
InsertReplaceEdit -> String
(Int -> InsertReplaceEdit -> ShowS)
-> (InsertReplaceEdit -> String)
-> ([InsertReplaceEdit] -> ShowS)
-> Show InsertReplaceEdit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InsertReplaceEdit -> ShowS
showsPrec :: Int -> InsertReplaceEdit -> ShowS
$cshow :: InsertReplaceEdit -> String
show :: InsertReplaceEdit -> String
$cshowList :: [InsertReplaceEdit] -> ShowS
showList :: [InsertReplaceEdit] -> ShowS
Show, InsertReplaceEdit -> InsertReplaceEdit -> Bool
(InsertReplaceEdit -> InsertReplaceEdit -> Bool)
-> (InsertReplaceEdit -> InsertReplaceEdit -> Bool)
-> Eq InsertReplaceEdit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
== :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c/= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
/= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
Eq, Eq InsertReplaceEdit
Eq InsertReplaceEdit =>
(InsertReplaceEdit -> InsertReplaceEdit -> Ordering)
-> (InsertReplaceEdit -> InsertReplaceEdit -> Bool)
-> (InsertReplaceEdit -> InsertReplaceEdit -> Bool)
-> (InsertReplaceEdit -> InsertReplaceEdit -> Bool)
-> (InsertReplaceEdit -> InsertReplaceEdit -> Bool)
-> (InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit)
-> (InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit)
-> Ord InsertReplaceEdit
InsertReplaceEdit -> InsertReplaceEdit -> Bool
InsertReplaceEdit -> InsertReplaceEdit -> Ordering
InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
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 :: InsertReplaceEdit -> InsertReplaceEdit -> Ordering
compare :: InsertReplaceEdit -> InsertReplaceEdit -> Ordering
$c< :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
< :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c<= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
<= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c> :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
> :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c>= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
>= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$cmax :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
max :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
$cmin :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
min :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
Ord, (forall x. InsertReplaceEdit -> Rep InsertReplaceEdit x)
-> (forall x. Rep InsertReplaceEdit x -> InsertReplaceEdit)
-> Generic InsertReplaceEdit
forall x. Rep InsertReplaceEdit x -> InsertReplaceEdit
forall x. InsertReplaceEdit -> Rep InsertReplaceEdit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InsertReplaceEdit -> Rep InsertReplaceEdit x
from :: forall x. InsertReplaceEdit -> Rep InsertReplaceEdit x
$cto :: forall x. Rep InsertReplaceEdit x -> InsertReplaceEdit
to :: forall x. Rep InsertReplaceEdit x -> InsertReplaceEdit
Generic)
deriving anyclass (InsertReplaceEdit -> ()
(InsertReplaceEdit -> ()) -> NFData InsertReplaceEdit
forall a. (a -> ()) -> NFData a
$crnf :: InsertReplaceEdit -> ()
rnf :: InsertReplaceEdit -> ()
NFData, Eq InsertReplaceEdit
Eq InsertReplaceEdit =>
(Int -> InsertReplaceEdit -> Int)
-> (InsertReplaceEdit -> Int) -> Hashable InsertReplaceEdit
Int -> InsertReplaceEdit -> Int
InsertReplaceEdit -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> InsertReplaceEdit -> Int
hashWithSalt :: Int -> InsertReplaceEdit -> Int
$chash :: InsertReplaceEdit -> Int
hash :: InsertReplaceEdit -> Int
Hashable)
deriving (forall ann. InsertReplaceEdit -> Doc ann)
-> (forall ann. [InsertReplaceEdit] -> Doc ann)
-> Pretty InsertReplaceEdit
forall ann. [InsertReplaceEdit] -> Doc ann
forall ann. InsertReplaceEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. InsertReplaceEdit -> Doc ann
pretty :: forall ann. InsertReplaceEdit -> Doc ann
$cprettyList :: forall ann. [InsertReplaceEdit] -> Doc ann
prettyList :: forall ann. [InsertReplaceEdit] -> Doc ann
Pretty via (ViaJSON InsertReplaceEdit)
instance Aeson.ToJSON InsertReplaceEdit where
toJSON :: InsertReplaceEdit -> Value
toJSON (InsertReplaceEdit Text
arg0 Range
arg1 Range
arg2) = [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
$ [[Key
"newText" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
,[Key
"insert" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg1]
,[Key
"replace" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg2]]
instance Aeson.FromJSON InsertReplaceEdit where
parseJSON :: Value -> Parser InsertReplaceEdit
parseJSON = String
-> (Object -> Parser InsertReplaceEdit)
-> Value
-> Parser InsertReplaceEdit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"InsertReplaceEdit" ((Object -> Parser InsertReplaceEdit)
-> Value -> Parser InsertReplaceEdit)
-> (Object -> Parser InsertReplaceEdit)
-> Value
-> Parser InsertReplaceEdit
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text -> Range -> Range -> InsertReplaceEdit
InsertReplaceEdit (Text -> Range -> Range -> InsertReplaceEdit)
-> Parser Text -> Parser (Range -> Range -> InsertReplaceEdit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"newText" Parser (Range -> Range -> InsertReplaceEdit)
-> Parser Range -> Parser (Range -> InsertReplaceEdit)
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 Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"insert" Parser (Range -> InsertReplaceEdit)
-> Parser Range -> Parser InsertReplaceEdit
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 Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"replace"