{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentFormattingParams] -> ShowS
$cshowList :: [DocumentFormattingParams] -> ShowS
show :: DocumentFormattingParams -> String
$cshow :: DocumentFormattingParams -> String
showsPrec :: Int -> DocumentFormattingParams -> ShowS
$cshowsPrec :: Int -> DocumentFormattingParams -> ShowS
Show, DocumentFormattingParams -> DocumentFormattingParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$c/= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
== :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$c== :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
Eq, Eq 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
min :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
$cmin :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
max :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
$cmax :: DocumentFormattingParams
-> DocumentFormattingParams -> DocumentFormattingParams
>= :: DocumentFormattingParams -> DocumentFormattingParams -> Bool
$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
compare :: DocumentFormattingParams -> DocumentFormattingParams -> Ordering
$ccompare :: DocumentFormattingParams -> DocumentFormattingParams -> Ordering
Ord, 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
$cto :: forall x.
Rep DocumentFormattingParams x -> DocumentFormattingParams
$cfrom :: forall x.
DocumentFormattingParams -> Rep DocumentFormattingParams x
Generic)
  deriving anyclass (DocumentFormattingParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: DocumentFormattingParams -> ()
$crnf :: DocumentFormattingParams -> ()
NFData, Eq DocumentFormattingParams
Int -> DocumentFormattingParams -> Int
DocumentFormattingParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: DocumentFormattingParams -> Int
$chash :: DocumentFormattingParams -> Int
hashWithSalt :: Int -> DocumentFormattingParams -> Int
$chashWithSalt :: Int -> DocumentFormattingParams -> Int
Hashable)
  deriving forall ann. [DocumentFormattingParams] -> Doc ann
forall ann. DocumentFormattingParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [DocumentFormattingParams] -> Doc ann
$cprettyList :: forall ann. [DocumentFormattingParams] -> Doc ann
pretty :: forall ann. DocumentFormattingParams -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [String
"workDoneToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
    ,[Key
"textDocument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg1]
    ,[Key
"options" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= FormattingOptions
arg2]]

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