{- 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.TextDocumentEdit 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 Language.LSP.Protocol.Internal.Types.AnnotatedTextEdit
import qualified Language.LSP.Protocol.Internal.Types.OptionalVersionedTextDocumentIdentifier
import qualified Language.LSP.Protocol.Internal.Types.TextEdit
import qualified Language.LSP.Protocol.Types.Common

{-|
Describes textual changes on a text document. A TextDocumentEdit describes all changes
on a document version Si and after they are applied move the document to version Si+1.
So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
kind of ordering. However the edits must be non overlapping.
-}
data TextDocumentEdit = TextDocumentEdit 
  { {-|
  The text document to change.
  -}
  TextDocumentEdit -> OptionalVersionedTextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.OptionalVersionedTextDocumentIdentifier.OptionalVersionedTextDocumentIdentifier
  , {-|
  The edits to be applied.

  @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
  client capability.
  -}
  TextDocumentEdit -> [TextEdit |? AnnotatedTextEdit]
_edits :: [(Language.LSP.Protocol.Internal.Types.TextEdit.TextEdit Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.AnnotatedTextEdit.AnnotatedTextEdit)]
  }
  deriving stock (Int -> TextDocumentEdit -> ShowS
[TextDocumentEdit] -> ShowS
TextDocumentEdit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDocumentEdit] -> ShowS
$cshowList :: [TextDocumentEdit] -> ShowS
show :: TextDocumentEdit -> String
$cshow :: TextDocumentEdit -> String
showsPrec :: Int -> TextDocumentEdit -> ShowS
$cshowsPrec :: Int -> TextDocumentEdit -> ShowS
Show, TextDocumentEdit -> TextDocumentEdit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDocumentEdit -> TextDocumentEdit -> Bool
$c/= :: TextDocumentEdit -> TextDocumentEdit -> Bool
== :: TextDocumentEdit -> TextDocumentEdit -> Bool
$c== :: TextDocumentEdit -> TextDocumentEdit -> Bool
Eq, Eq TextDocumentEdit
TextDocumentEdit -> TextDocumentEdit -> Bool
TextDocumentEdit -> TextDocumentEdit -> Ordering
TextDocumentEdit -> TextDocumentEdit -> TextDocumentEdit
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 :: TextDocumentEdit -> TextDocumentEdit -> TextDocumentEdit
$cmin :: TextDocumentEdit -> TextDocumentEdit -> TextDocumentEdit
max :: TextDocumentEdit -> TextDocumentEdit -> TextDocumentEdit
$cmax :: TextDocumentEdit -> TextDocumentEdit -> TextDocumentEdit
>= :: TextDocumentEdit -> TextDocumentEdit -> Bool
$c>= :: TextDocumentEdit -> TextDocumentEdit -> Bool
> :: TextDocumentEdit -> TextDocumentEdit -> Bool
$c> :: TextDocumentEdit -> TextDocumentEdit -> Bool
<= :: TextDocumentEdit -> TextDocumentEdit -> Bool
$c<= :: TextDocumentEdit -> TextDocumentEdit -> Bool
< :: TextDocumentEdit -> TextDocumentEdit -> Bool
$c< :: TextDocumentEdit -> TextDocumentEdit -> Bool
compare :: TextDocumentEdit -> TextDocumentEdit -> Ordering
$ccompare :: TextDocumentEdit -> TextDocumentEdit -> Ordering
Ord, forall x. Rep TextDocumentEdit x -> TextDocumentEdit
forall x. TextDocumentEdit -> Rep TextDocumentEdit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextDocumentEdit x -> TextDocumentEdit
$cfrom :: forall x. TextDocumentEdit -> Rep TextDocumentEdit x
Generic)
  deriving anyclass (TextDocumentEdit -> ()
forall a. (a -> ()) -> NFData a
rnf :: TextDocumentEdit -> ()
$crnf :: TextDocumentEdit -> ()
NFData, Eq TextDocumentEdit
Int -> TextDocumentEdit -> Int
TextDocumentEdit -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TextDocumentEdit -> Int
$chash :: TextDocumentEdit -> Int
hashWithSalt :: Int -> TextDocumentEdit -> Int
$chashWithSalt :: Int -> TextDocumentEdit -> Int
Hashable)
  deriving forall ann. [TextDocumentEdit] -> Doc ann
forall ann. TextDocumentEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [TextDocumentEdit] -> Doc ann
$cprettyList :: forall ann. [TextDocumentEdit] -> Doc ann
pretty :: forall ann. TextDocumentEdit -> Doc ann
$cpretty :: forall ann. TextDocumentEdit -> Doc ann
Pretty via (ViaJSON TextDocumentEdit)

instance Aeson.ToJSON TextDocumentEdit where
  toJSON :: TextDocumentEdit -> Value
toJSON (TextDocumentEdit OptionalVersionedTextDocumentIdentifier
arg0 [TextEdit |? AnnotatedTextEdit]
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
"textDocument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= OptionalVersionedTextDocumentIdentifier
arg0]
    ,[Key
"edits" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= [TextEdit |? AnnotatedTextEdit]
arg1]]

instance Aeson.FromJSON TextDocumentEdit where
  parseJSON :: Value -> Parser TextDocumentEdit
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"TextDocumentEdit" forall a b. (a -> b) -> a -> b
$ \Object
arg -> OptionalVersionedTextDocumentIdentifier
-> [TextEdit |? AnnotatedTextEdit] -> TextDocumentEdit
TextDocumentEdit forall (f :: * -> *) a b. Functor 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
"edits"