{- 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.TextDocumentPositionParams 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.Position
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier
import qualified Language.LSP.Protocol.Types.Common

{-|
A parameter literal used in requests to pass a text document and a position inside that
document.
-}
data TextDocumentPositionParams = TextDocumentPositionParams 
  { {-|
  The text document.
  -}
  TextDocumentPositionParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The position inside the text document.
  -}
  TextDocumentPositionParams -> Position
_position :: Language.LSP.Protocol.Internal.Types.Position.Position
  }
  deriving stock (Int -> TextDocumentPositionParams -> ShowS
[TextDocumentPositionParams] -> ShowS
TextDocumentPositionParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextDocumentPositionParams] -> ShowS
$cshowList :: [TextDocumentPositionParams] -> ShowS
show :: TextDocumentPositionParams -> String
$cshow :: TextDocumentPositionParams -> String
showsPrec :: Int -> TextDocumentPositionParams -> ShowS
$cshowsPrec :: Int -> TextDocumentPositionParams -> ShowS
Show, TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c/= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
== :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c== :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
Eq, Eq TextDocumentPositionParams
TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
TextDocumentPositionParams
-> TextDocumentPositionParams -> Ordering
TextDocumentPositionParams
-> TextDocumentPositionParams -> TextDocumentPositionParams
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 :: TextDocumentPositionParams
-> TextDocumentPositionParams -> TextDocumentPositionParams
$cmin :: TextDocumentPositionParams
-> TextDocumentPositionParams -> TextDocumentPositionParams
max :: TextDocumentPositionParams
-> TextDocumentPositionParams -> TextDocumentPositionParams
$cmax :: TextDocumentPositionParams
-> TextDocumentPositionParams -> TextDocumentPositionParams
>= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c>= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
> :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c> :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
<= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c<= :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
< :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
$c< :: TextDocumentPositionParams -> TextDocumentPositionParams -> Bool
compare :: TextDocumentPositionParams
-> TextDocumentPositionParams -> Ordering
$ccompare :: TextDocumentPositionParams
-> TextDocumentPositionParams -> Ordering
Ord, forall x.
Rep TextDocumentPositionParams x -> TextDocumentPositionParams
forall x.
TextDocumentPositionParams -> Rep TextDocumentPositionParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TextDocumentPositionParams x -> TextDocumentPositionParams
$cfrom :: forall x.
TextDocumentPositionParams -> Rep TextDocumentPositionParams x
Generic)
  deriving anyclass (TextDocumentPositionParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: TextDocumentPositionParams -> ()
$crnf :: TextDocumentPositionParams -> ()
NFData, Eq TextDocumentPositionParams
Int -> TextDocumentPositionParams -> Int
TextDocumentPositionParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TextDocumentPositionParams -> Int
$chash :: TextDocumentPositionParams -> Int
hashWithSalt :: Int -> TextDocumentPositionParams -> Int
$chashWithSalt :: Int -> TextDocumentPositionParams -> Int
Hashable)
  deriving forall ann. [TextDocumentPositionParams] -> Doc ann
forall ann. TextDocumentPositionParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [TextDocumentPositionParams] -> Doc ann
$cprettyList :: forall ann. [TextDocumentPositionParams] -> Doc ann
pretty :: forall ann. TextDocumentPositionParams -> Doc ann
$cpretty :: forall ann. TextDocumentPositionParams -> Doc ann
Pretty via (ViaJSON TextDocumentPositionParams)

instance Aeson.ToJSON TextDocumentPositionParams where
  toJSON :: TextDocumentPositionParams -> Value
toJSON (TextDocumentPositionParams TextDocumentIdentifier
arg0 Position
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..= TextDocumentIdentifier
arg0]
    ,[Key
"position" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Position
arg1]]

instance Aeson.FromJSON TextDocumentPositionParams where
  parseJSON :: Value -> Parser TextDocumentPositionParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"TextDocumentPositionParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> TextDocumentIdentifier -> Position -> TextDocumentPositionParams
TextDocumentPositionParams 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
"position"