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

{-|
Completion parameters
-}
data CompletionParams = CompletionParams 
  { {-|
  The text document.
  -}
  CompletionParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The position inside the text document.
  -}
  CompletionParams -> Position
_position :: Language.LSP.Protocol.Internal.Types.Position.Position
  , {-|
  An optional token that a server can use to report work done progress.
  -}
  CompletionParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  An optional token that a server can use to report partial results (e.g. streaming) to
  the client.
  -}
  CompletionParams -> Maybe ProgressToken
_partialResultToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The completion context. This is only available it the client specifies
  to send this using the client capability `textDocument.completion.contextSupport === true`
  -}
  CompletionParams -> Maybe CompletionContext
_context :: (Maybe Language.LSP.Protocol.Internal.Types.CompletionContext.CompletionContext)
  }
  deriving stock (Int -> CompletionParams -> ShowS
[CompletionParams] -> ShowS
CompletionParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompletionParams] -> ShowS
$cshowList :: [CompletionParams] -> ShowS
show :: CompletionParams -> String
$cshow :: CompletionParams -> String
showsPrec :: Int -> CompletionParams -> ShowS
$cshowsPrec :: Int -> CompletionParams -> ShowS
Show, CompletionParams -> CompletionParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompletionParams -> CompletionParams -> Bool
$c/= :: CompletionParams -> CompletionParams -> Bool
== :: CompletionParams -> CompletionParams -> Bool
$c== :: CompletionParams -> CompletionParams -> Bool
Eq, Eq CompletionParams
CompletionParams -> CompletionParams -> Bool
CompletionParams -> CompletionParams -> Ordering
CompletionParams -> CompletionParams -> CompletionParams
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 :: CompletionParams -> CompletionParams -> CompletionParams
$cmin :: CompletionParams -> CompletionParams -> CompletionParams
max :: CompletionParams -> CompletionParams -> CompletionParams
$cmax :: CompletionParams -> CompletionParams -> CompletionParams
>= :: CompletionParams -> CompletionParams -> Bool
$c>= :: CompletionParams -> CompletionParams -> Bool
> :: CompletionParams -> CompletionParams -> Bool
$c> :: CompletionParams -> CompletionParams -> Bool
<= :: CompletionParams -> CompletionParams -> Bool
$c<= :: CompletionParams -> CompletionParams -> Bool
< :: CompletionParams -> CompletionParams -> Bool
$c< :: CompletionParams -> CompletionParams -> Bool
compare :: CompletionParams -> CompletionParams -> Ordering
$ccompare :: CompletionParams -> CompletionParams -> Ordering
Ord, forall x. Rep CompletionParams x -> CompletionParams
forall x. CompletionParams -> Rep CompletionParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompletionParams x -> CompletionParams
$cfrom :: forall x. CompletionParams -> Rep CompletionParams x
Generic)
  deriving anyclass (CompletionParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: CompletionParams -> ()
$crnf :: CompletionParams -> ()
NFData, Eq CompletionParams
Int -> CompletionParams -> Int
CompletionParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CompletionParams -> Int
$chash :: CompletionParams -> Int
hashWithSalt :: Int -> CompletionParams -> Int
$chashWithSalt :: Int -> CompletionParams -> Int
Hashable)
  deriving forall ann. [CompletionParams] -> Doc ann
forall ann. CompletionParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [CompletionParams] -> Doc ann
$cprettyList :: forall ann. [CompletionParams] -> Doc ann
pretty :: forall ann. CompletionParams -> Doc ann
$cpretty :: forall ann. CompletionParams -> Doc ann
Pretty via (ViaJSON CompletionParams)

instance Aeson.ToJSON CompletionParams where
  toJSON :: CompletionParams -> Value
toJSON (CompletionParams TextDocumentIdentifier
arg0 Position
arg1 Maybe ProgressToken
arg2 Maybe ProgressToken
arg3 Maybe CompletionContext
arg4) = [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]
    ,String
"workDoneToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg2
    ,String
"partialResultToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg3
    ,String
"context" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe CompletionContext
arg4]

instance Aeson.FromJSON CompletionParams where
  parseJSON :: Value -> Parser CompletionParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CompletionParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> TextDocumentIdentifier
-> Position
-> Maybe ProgressToken
-> Maybe ProgressToken
-> Maybe CompletionContext
-> CompletionParams
CompletionParams 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 (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 (Maybe a)
Aeson..:! Key
"partialResultToken" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"context"