{- 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.SignatureHelpContext 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.SignatureHelp
import qualified Language.LSP.Protocol.Internal.Types.SignatureHelpTriggerKind
import qualified Language.LSP.Protocol.Types.Common

{-|
Additional information about the context in which a signature help request was triggered.

@since 3.15.0
-}
data SignatureHelpContext = SignatureHelpContext 
  { {-|
  Action that caused signature help to be triggered.
  -}
  SignatureHelpContext -> SignatureHelpTriggerKind
_triggerKind :: Language.LSP.Protocol.Internal.Types.SignatureHelpTriggerKind.SignatureHelpTriggerKind
  , {-|
  Character that caused signature help to be triggered.

  This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
  -}
  SignatureHelpContext -> Maybe Text
_triggerCharacter :: (Maybe Data.Text.Text)
  , {-|
  `true` if signature help was already showing when it was triggered.

  Retriggers occurs when the signature help is already active and can be caused by actions such as
  typing a trigger character, a cursor move, or document content changes.
  -}
  SignatureHelpContext -> Bool
_isRetrigger :: Bool
  , {-|
  The currently active `SignatureHelp`.

  The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
  the user navigating through available signatures.
  -}
  SignatureHelpContext -> Maybe SignatureHelp
_activeSignatureHelp :: (Maybe Language.LSP.Protocol.Internal.Types.SignatureHelp.SignatureHelp)
  }
  deriving stock (Int -> SignatureHelpContext -> ShowS
[SignatureHelpContext] -> ShowS
SignatureHelpContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SignatureHelpContext] -> ShowS
$cshowList :: [SignatureHelpContext] -> ShowS
show :: SignatureHelpContext -> String
$cshow :: SignatureHelpContext -> String
showsPrec :: Int -> SignatureHelpContext -> ShowS
$cshowsPrec :: Int -> SignatureHelpContext -> ShowS
Show, SignatureHelpContext -> SignatureHelpContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SignatureHelpContext -> SignatureHelpContext -> Bool
$c/= :: SignatureHelpContext -> SignatureHelpContext -> Bool
== :: SignatureHelpContext -> SignatureHelpContext -> Bool
$c== :: SignatureHelpContext -> SignatureHelpContext -> Bool
Eq, Eq SignatureHelpContext
SignatureHelpContext -> SignatureHelpContext -> Bool
SignatureHelpContext -> SignatureHelpContext -> Ordering
SignatureHelpContext
-> SignatureHelpContext -> SignatureHelpContext
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 :: SignatureHelpContext
-> SignatureHelpContext -> SignatureHelpContext
$cmin :: SignatureHelpContext
-> SignatureHelpContext -> SignatureHelpContext
max :: SignatureHelpContext
-> SignatureHelpContext -> SignatureHelpContext
$cmax :: SignatureHelpContext
-> SignatureHelpContext -> SignatureHelpContext
>= :: SignatureHelpContext -> SignatureHelpContext -> Bool
$c>= :: SignatureHelpContext -> SignatureHelpContext -> Bool
> :: SignatureHelpContext -> SignatureHelpContext -> Bool
$c> :: SignatureHelpContext -> SignatureHelpContext -> Bool
<= :: SignatureHelpContext -> SignatureHelpContext -> Bool
$c<= :: SignatureHelpContext -> SignatureHelpContext -> Bool
< :: SignatureHelpContext -> SignatureHelpContext -> Bool
$c< :: SignatureHelpContext -> SignatureHelpContext -> Bool
compare :: SignatureHelpContext -> SignatureHelpContext -> Ordering
$ccompare :: SignatureHelpContext -> SignatureHelpContext -> Ordering
Ord, forall x. Rep SignatureHelpContext x -> SignatureHelpContext
forall x. SignatureHelpContext -> Rep SignatureHelpContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SignatureHelpContext x -> SignatureHelpContext
$cfrom :: forall x. SignatureHelpContext -> Rep SignatureHelpContext x
Generic)
  deriving anyclass (SignatureHelpContext -> ()
forall a. (a -> ()) -> NFData a
rnf :: SignatureHelpContext -> ()
$crnf :: SignatureHelpContext -> ()
NFData, Eq SignatureHelpContext
Int -> SignatureHelpContext -> Int
SignatureHelpContext -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SignatureHelpContext -> Int
$chash :: SignatureHelpContext -> Int
hashWithSalt :: Int -> SignatureHelpContext -> Int
$chashWithSalt :: Int -> SignatureHelpContext -> Int
Hashable)
  deriving forall ann. [SignatureHelpContext] -> Doc ann
forall ann. SignatureHelpContext -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [SignatureHelpContext] -> Doc ann
$cprettyList :: forall ann. [SignatureHelpContext] -> Doc ann
pretty :: forall ann. SignatureHelpContext -> Doc ann
$cpretty :: forall ann. SignatureHelpContext -> Doc ann
Pretty via (ViaJSON SignatureHelpContext)

instance Aeson.ToJSON SignatureHelpContext where
  toJSON :: SignatureHelpContext -> Value
toJSON (SignatureHelpContext SignatureHelpTriggerKind
arg0 Maybe Text
arg1 Bool
arg2 Maybe SignatureHelp
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
"triggerKind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= SignatureHelpTriggerKind
arg0]
    ,String
"triggerCharacter" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg1
    ,[Key
"isRetrigger" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Bool
arg2]
    ,String
"activeSignatureHelp" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe SignatureHelp
arg3]

instance Aeson.FromJSON SignatureHelpContext where
  parseJSON :: Value -> Parser SignatureHelpContext
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SignatureHelpContext" forall a b. (a -> b) -> a -> b
$ \Object
arg -> SignatureHelpTriggerKind
-> Maybe Text
-> Bool
-> Maybe SignatureHelp
-> SignatureHelpContext
SignatureHelpContext forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"triggerKind" 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
"triggerCharacter" 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
"isRetrigger" 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
"activeSignatureHelp"