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

{-|
The parameters of a `DocumentFormattingRequest`.
-}
data DocumentFormattingParams = DocumentFormattingParams 
  { {-|
  An optional token that a server can use to report work done progress.
  -}
  DocumentFormattingParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The document to format.
  -}
  DocumentFormattingParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The format options.
  -}
  DocumentFormattingParams -> FormattingOptions
_options :: Language.LSP.Protocol.Internal.Types.FormattingOptions.FormattingOptions
  }
  deriving stock (Int -> DocumentFormattingParams -> ShowS
[DocumentFormattingParams] -> ShowS
DocumentFormattingParams -> String
(Int -> DocumentFormattingParams -> ShowS)
-> (DocumentFormattingParams -> String)
-> ([DocumentFormattingParams] -> ShowS)
-> Show DocumentFormattingParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DocumentFormattingParams -> ShowS
showsPrec :: Int -> DocumentFormattingParams -> ShowS
$cshow :: DocumentFormattingParams -> String
show :: DocumentFormattingParams -> String
$cshowList :: [DocumentFormattingParams] -> ShowS
showList :: [DocumentFormattingParams] -> ShowS
Show, DocumentFormattingParams -> DocumentFormattingParams -> Bool
(DocumentFormattingParams -> DocumentFormattingParams -> Bool)
-> (DocumentFormattingParams -> DocumentFormattingParams -> Bool)
-> Eq DocumentFormattingParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
== :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$c/= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
/= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
Eq, Eq DocumentFormattingParams
Eq DocumentFormattingParams =>
(DocumentFormattingParams -> DocumentFormattingParams -> Ordering)
-> (DocumentFormattingParams -> DocumentFormattingParams -> Bool)
-> (DocumentFormattingParams -> DocumentFormattingParams -> Bool)
-> (DocumentFormattingParams -> DocumentFormattingParams -> Bool)
-> (DocumentFormattingParams -> DocumentFormattingParams -> Bool)
-> (DocumentFormattingParams
    -> DocumentFormattingParams -> DocumentFormattingParams)
-> (DocumentFormattingParams
    -> DocumentFormattingParams -> DocumentFormattingParams)
-> Ord DocumentFormattingParams
DocumentFormattingParams -> DocumentFormattingParams -> Bool
DocumentFormattingParams -> DocumentFormattingParams -> Ordering
DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
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 :: DocumentFormattingParams -> DocumentFormattingParams -> Ordering
compare :: DocumentFormattingParams -> DocumentFormattingParams -> Ordering
$c< :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
< :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$c<= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
<= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$c> :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
> :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$c>= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
>= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$cmax :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
max :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
$cmin :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
min :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
Ord, (forall x.
 DocumentFormattingParams -> Rep DocumentFormattingParams x)
-> (forall x.
    Rep DocumentFormattingParams x -> DocumentFormattingParams)
-> Generic DocumentFormattingParams
forall x.
Rep DocumentFormattingParams x -> DocumentFormattingParams
forall x.
DocumentFormattingParams -> Rep DocumentFormattingParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
DocumentFormattingParams -> Rep DocumentFormattingParams x
from :: forall x.
DocumentFormattingParams -> Rep DocumentFormattingParams x
$cto :: forall x.
Rep DocumentFormattingParams x -> DocumentFormattingParams
to :: forall x.
Rep DocumentFormattingParams x -> DocumentFormattingParams
Generic)
  deriving anyclass (DocumentFormattingParams -> ()
(DocumentFormattingParams -> ()) -> NFData DocumentFormattingParams
forall a. (a -> ()) -> NFData a
$crnf :: DocumentFormattingParams -> ()
rnf :: DocumentFormattingParams -> ()
NFData, Eq DocumentFormattingParams
Eq DocumentFormattingParams =>
(Int -> DocumentFormattingParams -> Int)
-> (DocumentFormattingParams -> Int)
-> Hashable DocumentFormattingParams
Int -> DocumentFormattingParams -> Int
DocumentFormattingParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> DocumentFormattingParams -> Int
hashWithSalt :: Int -> DocumentFormattingParams -> Int
$chash :: DocumentFormattingParams -> Int
hash :: DocumentFormattingParams -> Int
Hashable)
  deriving (forall ann. DocumentFormattingParams -> Doc ann)
-> (forall ann. [DocumentFormattingParams] -> Doc ann)
-> Pretty DocumentFormattingParams
forall ann. [DocumentFormattingParams] -> Doc ann
forall ann. DocumentFormattingParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. DocumentFormattingParams -> Doc ann
pretty :: forall ann. DocumentFormattingParams -> Doc ann
$cprettyList :: forall ann. [DocumentFormattingParams] -> Doc ann
prettyList :: forall ann. [DocumentFormattingParams] -> Doc ann
Pretty via (ViaJSON DocumentFormattingParams)

instance Aeson.ToJSON DocumentFormattingParams where
  toJSON :: DocumentFormattingParams -> Value
toJSON (DocumentFormattingParams Maybe ProgressToken
arg0 TextDocumentIdentifier
arg1 FormattingOptions
arg2) = [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
$  [String
"workDoneToken" String -> Maybe ProgressToken -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
    ,[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
arg1]
    ,[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
arg2]]

instance Aeson.FromJSON DocumentFormattingParams where
  parseJSON :: Value -> Parser DocumentFormattingParams
parseJSON = String
-> (Object -> Parser DocumentFormattingParams)
-> Value
-> Parser DocumentFormattingParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DocumentFormattingParams" ((Object -> Parser DocumentFormattingParams)
 -> Value -> Parser DocumentFormattingParams)
-> (Object -> Parser DocumentFormattingParams)
-> Value
-> Parser DocumentFormattingParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> TextDocumentIdentifier
-> FormattingOptions
-> DocumentFormattingParams
DocumentFormattingParams (Maybe ProgressToken
 -> TextDocumentIdentifier
 -> FormattingOptions
 -> DocumentFormattingParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (TextDocumentIdentifier
      -> FormattingOptions -> DocumentFormattingParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"workDoneToken" Parser
  (TextDocumentIdentifier
   -> FormattingOptions -> DocumentFormattingParams)
-> Parser TextDocumentIdentifier
-> Parser (FormattingOptions -> DocumentFormattingParams)
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 TextDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument" Parser (FormattingOptions -> DocumentFormattingParams)
-> Parser FormattingOptions -> Parser DocumentFormattingParams
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"