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

{-|
The parameters of a `DocumentOnTypeFormattingRequest`.
-}
data DocumentOnTypeFormattingParams = DocumentOnTypeFormattingParams 
  { {-|
  The document to format.
  -}
  DocumentOnTypeFormattingParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The position around which the on type formatting should happen.
  This is not necessarily the exact position where the character denoted
  by the property `ch` got typed.
  -}
  DocumentOnTypeFormattingParams -> Position
_position :: Language.LSP.Protocol.Internal.Types.Position.Position
  , {-|
  The character that has been typed that triggered the formatting
  on type request. That is not necessarily the last character that
  got inserted into the document since the client could auto insert
  characters as well (e.g. like automatic brace completion).
  -}
  DocumentOnTypeFormattingParams -> Text
_ch :: Data.Text.Text
  , {-|
  The formatting options.
  -}
  DocumentOnTypeFormattingParams -> FormattingOptions
_options :: Language.LSP.Protocol.Internal.Types.FormattingOptions.FormattingOptions
  }
  deriving stock (Int -> DocumentOnTypeFormattingParams -> ShowS
[DocumentOnTypeFormattingParams] -> ShowS
DocumentOnTypeFormattingParams -> String
(Int -> DocumentOnTypeFormattingParams -> ShowS)
-> (DocumentOnTypeFormattingParams -> String)
-> ([DocumentOnTypeFormattingParams] -> ShowS)
-> Show DocumentOnTypeFormattingParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DocumentOnTypeFormattingParams -> ShowS
showsPrec :: Int -> DocumentOnTypeFormattingParams -> ShowS
$cshow :: DocumentOnTypeFormattingParams -> String
show :: DocumentOnTypeFormattingParams -> String
$cshowList :: [DocumentOnTypeFormattingParams] -> ShowS
showList :: [DocumentOnTypeFormattingParams] -> ShowS
Show, DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
(DocumentOnTypeFormattingParams
 -> DocumentOnTypeFormattingParams -> Bool)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams -> Bool)
-> Eq DocumentOnTypeFormattingParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
== :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
$c/= :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
/= :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
Eq, Eq DocumentOnTypeFormattingParams
Eq DocumentOnTypeFormattingParams =>
(DocumentOnTypeFormattingParams
 -> DocumentOnTypeFormattingParams -> Ordering)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams -> Bool)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams -> Bool)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams -> Bool)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams -> Bool)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams)
-> (DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams
    -> DocumentOnTypeFormattingParams)
-> Ord DocumentOnTypeFormattingParams
DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Ordering
DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> DocumentOnTypeFormattingParams
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 :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Ordering
compare :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Ordering
$c< :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
< :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
$c<= :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
<= :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
$c> :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
> :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
$c>= :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
>= :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> Bool
$cmax :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> DocumentOnTypeFormattingParams
max :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> DocumentOnTypeFormattingParams
$cmin :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> DocumentOnTypeFormattingParams
min :: DocumentOnTypeFormattingParams
-> DocumentOnTypeFormattingParams -> DocumentOnTypeFormattingParams
Ord, (forall x.
 DocumentOnTypeFormattingParams
 -> Rep DocumentOnTypeFormattingParams x)
-> (forall x.
    Rep DocumentOnTypeFormattingParams x
    -> DocumentOnTypeFormattingParams)
-> Generic DocumentOnTypeFormattingParams
forall x.
Rep DocumentOnTypeFormattingParams x
-> DocumentOnTypeFormattingParams
forall x.
DocumentOnTypeFormattingParams
-> Rep DocumentOnTypeFormattingParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
DocumentOnTypeFormattingParams
-> Rep DocumentOnTypeFormattingParams x
from :: forall x.
DocumentOnTypeFormattingParams
-> Rep DocumentOnTypeFormattingParams x
$cto :: forall x.
Rep DocumentOnTypeFormattingParams x
-> DocumentOnTypeFormattingParams
to :: forall x.
Rep DocumentOnTypeFormattingParams x
-> DocumentOnTypeFormattingParams
Generic)
  deriving anyclass (DocumentOnTypeFormattingParams -> ()
(DocumentOnTypeFormattingParams -> ())
-> NFData DocumentOnTypeFormattingParams
forall a. (a -> ()) -> NFData a
$crnf :: DocumentOnTypeFormattingParams -> ()
rnf :: DocumentOnTypeFormattingParams -> ()
NFData, Eq DocumentOnTypeFormattingParams
Eq DocumentOnTypeFormattingParams =>
(Int -> DocumentOnTypeFormattingParams -> Int)
-> (DocumentOnTypeFormattingParams -> Int)
-> Hashable DocumentOnTypeFormattingParams
Int -> DocumentOnTypeFormattingParams -> Int
DocumentOnTypeFormattingParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> DocumentOnTypeFormattingParams -> Int
hashWithSalt :: Int -> DocumentOnTypeFormattingParams -> Int
$chash :: DocumentOnTypeFormattingParams -> Int
hash :: DocumentOnTypeFormattingParams -> Int
Hashable)
  deriving (forall ann. DocumentOnTypeFormattingParams -> Doc ann)
-> (forall ann. [DocumentOnTypeFormattingParams] -> Doc ann)
-> Pretty DocumentOnTypeFormattingParams
forall ann. [DocumentOnTypeFormattingParams] -> Doc ann
forall ann. DocumentOnTypeFormattingParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. DocumentOnTypeFormattingParams -> Doc ann
pretty :: forall ann. DocumentOnTypeFormattingParams -> Doc ann
$cprettyList :: forall ann. [DocumentOnTypeFormattingParams] -> Doc ann
prettyList :: forall ann. [DocumentOnTypeFormattingParams] -> Doc ann
Pretty via (ViaJSON DocumentOnTypeFormattingParams)

instance Aeson.ToJSON DocumentOnTypeFormattingParams where
  toJSON :: DocumentOnTypeFormattingParams -> Value
toJSON (DocumentOnTypeFormattingParams TextDocumentIdentifier
arg0 Position
arg1 Text
arg2 FormattingOptions
arg3) = [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
"textDocument" Key -> TextDocumentIdentifier -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg0]
    ,[Key
"position" Key -> Position -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Position
arg1]
    ,[Key
"ch" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg2]
    ,[Key
"options" Key -> FormattingOptions -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= FormattingOptions
arg3]]

instance Aeson.FromJSON DocumentOnTypeFormattingParams where
  parseJSON :: Value -> Parser DocumentOnTypeFormattingParams
parseJSON = String
-> (Object -> Parser DocumentOnTypeFormattingParams)
-> Value
-> Parser DocumentOnTypeFormattingParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DocumentOnTypeFormattingParams" ((Object -> Parser DocumentOnTypeFormattingParams)
 -> Value -> Parser DocumentOnTypeFormattingParams)
-> (Object -> Parser DocumentOnTypeFormattingParams)
-> Value
-> Parser DocumentOnTypeFormattingParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> TextDocumentIdentifier
-> Position
-> Text
-> FormattingOptions
-> DocumentOnTypeFormattingParams
DocumentOnTypeFormattingParams (TextDocumentIdentifier
 -> Position
 -> Text
 -> FormattingOptions
 -> DocumentOnTypeFormattingParams)
-> Parser TextDocumentIdentifier
-> Parser
     (Position
      -> Text -> FormattingOptions -> DocumentOnTypeFormattingParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser TextDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument" Parser
  (Position
   -> Text -> FormattingOptions -> DocumentOnTypeFormattingParams)
-> Parser Position
-> Parser
     (Text -> FormattingOptions -> DocumentOnTypeFormattingParams)
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 Position
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"position" Parser
  (Text -> FormattingOptions -> DocumentOnTypeFormattingParams)
-> Parser Text
-> Parser (FormattingOptions -> DocumentOnTypeFormattingParams)
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
"ch" Parser (FormattingOptions -> DocumentOnTypeFormattingParams)
-> Parser FormattingOptions
-> Parser DocumentOnTypeFormattingParams
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 FormattingOptions
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"options"