{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextEdit] -> ShowS
$cshowList :: [TextEdit] -> ShowS
show :: TextEdit -> String
$cshow :: TextEdit -> String
showsPrec :: Int -> TextEdit -> ShowS
$cshowsPrec :: Int -> TextEdit -> ShowS
Show, TextEdit -> TextEdit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextEdit -> TextEdit -> Bool
$c/= :: TextEdit -> TextEdit -> Bool
== :: TextEdit -> TextEdit -> Bool
$c== :: TextEdit -> TextEdit -> Bool
Eq, Eq 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
min :: TextEdit -> TextEdit -> TextEdit
$cmin :: TextEdit -> TextEdit -> TextEdit
max :: TextEdit -> TextEdit -> TextEdit
$cmax :: TextEdit -> TextEdit -> TextEdit
>= :: TextEdit -> TextEdit -> Bool
$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
compare :: TextEdit -> TextEdit -> Ordering
$ccompare :: TextEdit -> TextEdit -> Ordering
Ord, 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
$cto :: forall x. Rep TextEdit x -> TextEdit
$cfrom :: forall x. TextEdit -> Rep TextEdit x
Generic)
  deriving anyclass (TextEdit -> ()
forall a. (a -> ()) -> NFData a
rnf :: TextEdit -> ()
$crnf :: TextEdit -> ()
NFData, Eq TextEdit
Int -> TextEdit -> Int
TextEdit -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TextEdit -> Int
$chash :: TextEdit -> Int
hashWithSalt :: Int -> TextEdit -> Int
$chashWithSalt :: Int -> TextEdit -> Int
Hashable)
  deriving forall ann. [TextEdit] -> Doc ann
forall ann. TextEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [TextEdit] -> Doc ann
$cprettyList :: forall ann. [TextEdit] -> Doc ann
pretty :: forall ann. TextEdit -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [[Key
"range" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg0]
    ,[Key
"newText" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]]

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