{- ORMOLU_DISABLE -}
{- HLINT ignore -}
-- THIS IS A GENERATED FILE, DO NOT EDIT

{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.TextEdit 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

{-|
A text edit applicable to a text document.
-}
data TextEdit = TextEdit 
  { {-|
  The range of the text document to be manipulated. To insert
  text into a document create a range where start === end.
  -}
  TextEdit -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The string to be inserted. For delete operations use an
  empty string.
  -}
  TextEdit -> Text
_newText :: Data.Text.Text
  }
  deriving stock (Int -> TextEdit -> ShowS
[TextEdit] -> ShowS
TextEdit -> String
(Int -> TextEdit -> ShowS)
-> (TextEdit -> String) -> ([TextEdit] -> ShowS) -> Show TextEdit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextEdit -> ShowS
showsPrec :: Int -> TextEdit -> ShowS
$cshow :: TextEdit -> String
show :: TextEdit -> String
$cshowList :: [TextEdit] -> ShowS
showList :: [TextEdit] -> ShowS
Show, TextEdit -> TextEdit -> Bool
(TextEdit -> TextEdit -> Bool)
-> (TextEdit -> TextEdit -> Bool) -> Eq TextEdit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextEdit -> TextEdit -> Bool
== :: TextEdit -> TextEdit -> Bool
$c/= :: TextEdit -> TextEdit -> Bool
/= :: TextEdit -> TextEdit -> Bool
Eq, Eq TextEdit
Eq TextEdit =>
(TextEdit -> TextEdit -> Ordering)
-> (TextEdit -> TextEdit -> Bool)
-> (TextEdit -> TextEdit -> Bool)
-> (TextEdit -> TextEdit -> Bool)
-> (TextEdit -> TextEdit -> Bool)
-> (TextEdit -> TextEdit -> TextEdit)
-> (TextEdit -> TextEdit -> TextEdit)
-> Ord TextEdit
TextEdit -> TextEdit -> Bool
TextEdit -> TextEdit -> Ordering
TextEdit -> TextEdit -> TextEdit
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 :: TextEdit -> TextEdit -> Ordering
compare :: TextEdit -> TextEdit -> Ordering
$c< :: TextEdit -> TextEdit -> Bool
< :: TextEdit -> TextEdit -> Bool
$c<= :: TextEdit -> TextEdit -> Bool
<= :: TextEdit -> TextEdit -> Bool
$c> :: TextEdit -> TextEdit -> Bool
> :: TextEdit -> TextEdit -> Bool
$c>= :: TextEdit -> TextEdit -> Bool
>= :: TextEdit -> TextEdit -> Bool
$cmax :: TextEdit -> TextEdit -> TextEdit
max :: TextEdit -> TextEdit -> TextEdit
$cmin :: TextEdit -> TextEdit -> TextEdit
min :: TextEdit -> TextEdit -> TextEdit
Ord, (forall x. TextEdit -> Rep TextEdit x)
-> (forall x. Rep TextEdit x -> TextEdit) -> Generic TextEdit
forall x. Rep TextEdit x -> TextEdit
forall x. TextEdit -> Rep TextEdit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TextEdit -> Rep TextEdit x
from :: forall x. TextEdit -> Rep TextEdit x
$cto :: forall x. Rep TextEdit x -> TextEdit
to :: forall x. Rep TextEdit x -> TextEdit
Generic)
  deriving anyclass (TextEdit -> ()
(TextEdit -> ()) -> NFData TextEdit
forall a. (a -> ()) -> NFData a
$crnf :: TextEdit -> ()
rnf :: TextEdit -> ()
NFData, Eq TextEdit
Eq TextEdit =>
(Int -> TextEdit -> Int) -> (TextEdit -> Int) -> Hashable TextEdit
Int -> TextEdit -> Int
TextEdit -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> TextEdit -> Int
hashWithSalt :: Int -> TextEdit -> Int
$chash :: TextEdit -> Int
hash :: TextEdit -> Int
Hashable)
  deriving (forall ann. TextEdit -> Doc ann)
-> (forall ann. [TextEdit] -> Doc ann) -> Pretty TextEdit
forall ann. [TextEdit] -> Doc ann
forall ann. TextEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. TextEdit -> Doc ann
pretty :: forall ann. TextEdit -> Doc ann
$cprettyList :: forall ann. [TextEdit] -> Doc ann
prettyList :: forall ann. [TextEdit] -> Doc ann
Pretty via (ViaJSON TextEdit)

instance Aeson.ToJSON TextEdit where
  toJSON :: TextEdit -> Value
toJSON (TextEdit Range
arg0 Text
arg1) = [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
"range" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg0]
    ,[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
arg1]]

instance Aeson.FromJSON TextEdit where
  parseJSON :: Value -> Parser TextEdit
parseJSON = String -> (Object -> Parser TextEdit) -> Value -> Parser TextEdit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"TextEdit" ((Object -> Parser TextEdit) -> Value -> Parser TextEdit)
-> (Object -> Parser TextEdit) -> Value -> Parser TextEdit
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Text -> TextEdit
TextEdit (Range -> Text -> TextEdit)
-> Parser Range -> Parser (Text -> TextEdit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" Parser (Text -> TextEdit) -> Parser Text -> Parser TextEdit
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
"newText"