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

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