{- 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.SignatureInformation 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.MarkupContent
import qualified Language.LSP.Protocol.Internal.Types.ParameterInformation
import qualified Language.LSP.Protocol.Types.Common

{-|
Represents the signature of something callable. A signature
can have a label, like a function-name, a doc-comment, and
a set of parameters.
-}
data SignatureInformation = SignatureInformation 
  { {-|
  The label of this signature. Will be shown in
  the UI.
  -}
  SignatureInformation -> Text
_label :: Data.Text.Text
  , {-|
  The human-readable doc-comment of this signature. Will be shown
  in the UI but can be omitted.
  -}
  SignatureInformation -> Maybe (Text |? MarkupContent)
_documentation :: (Maybe (Data.Text.Text Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.MarkupContent.MarkupContent))
  , {-|
  The parameters of this signature.
  -}
  SignatureInformation -> Maybe [ParameterInformation]
_parameters :: (Maybe [Language.LSP.Protocol.Internal.Types.ParameterInformation.ParameterInformation])
  , {-|
  The index of the active parameter.

  If provided, this is used in place of `SignatureHelp.activeParameter`.

  @since 3.16.0
  -}
  SignatureInformation -> Maybe UInt
_activeParameter :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
  }
  deriving stock (Int -> SignatureInformation -> ShowS
[SignatureInformation] -> ShowS
SignatureInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SignatureInformation] -> ShowS
$cshowList :: [SignatureInformation] -> ShowS
show :: SignatureInformation -> String
$cshow :: SignatureInformation -> String
showsPrec :: Int -> SignatureInformation -> ShowS
$cshowsPrec :: Int -> SignatureInformation -> ShowS
Show, SignatureInformation -> SignatureInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SignatureInformation -> SignatureInformation -> Bool
$c/= :: SignatureInformation -> SignatureInformation -> Bool
== :: SignatureInformation -> SignatureInformation -> Bool
$c== :: SignatureInformation -> SignatureInformation -> Bool
Eq, Eq SignatureInformation
SignatureInformation -> SignatureInformation -> Bool
SignatureInformation -> SignatureInformation -> Ordering
SignatureInformation
-> SignatureInformation -> SignatureInformation
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 :: SignatureInformation
-> SignatureInformation -> SignatureInformation
$cmin :: SignatureInformation
-> SignatureInformation -> SignatureInformation
max :: SignatureInformation
-> SignatureInformation -> SignatureInformation
$cmax :: SignatureInformation
-> SignatureInformation -> SignatureInformation
>= :: SignatureInformation -> SignatureInformation -> Bool
$c>= :: SignatureInformation -> SignatureInformation -> Bool
> :: SignatureInformation -> SignatureInformation -> Bool
$c> :: SignatureInformation -> SignatureInformation -> Bool
<= :: SignatureInformation -> SignatureInformation -> Bool
$c<= :: SignatureInformation -> SignatureInformation -> Bool
< :: SignatureInformation -> SignatureInformation -> Bool
$c< :: SignatureInformation -> SignatureInformation -> Bool
compare :: SignatureInformation -> SignatureInformation -> Ordering
$ccompare :: SignatureInformation -> SignatureInformation -> Ordering
Ord, forall x. Rep SignatureInformation x -> SignatureInformation
forall x. SignatureInformation -> Rep SignatureInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SignatureInformation x -> SignatureInformation
$cfrom :: forall x. SignatureInformation -> Rep SignatureInformation x
Generic)
  deriving anyclass (SignatureInformation -> ()
forall a. (a -> ()) -> NFData a
rnf :: SignatureInformation -> ()
$crnf :: SignatureInformation -> ()
NFData, Eq SignatureInformation
Int -> SignatureInformation -> Int
SignatureInformation -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SignatureInformation -> Int
$chash :: SignatureInformation -> Int
hashWithSalt :: Int -> SignatureInformation -> Int
$chashWithSalt :: Int -> SignatureInformation -> Int
Hashable)
  deriving forall ann. [SignatureInformation] -> Doc ann
forall ann. SignatureInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [SignatureInformation] -> Doc ann
$cprettyList :: forall ann. [SignatureInformation] -> Doc ann
pretty :: forall ann. SignatureInformation -> Doc ann
$cpretty :: forall ann. SignatureInformation -> Doc ann
Pretty via (ViaJSON SignatureInformation)

instance Aeson.ToJSON SignatureInformation where
  toJSON :: SignatureInformation -> Value
toJSON (SignatureInformation Text
arg0 Maybe (Text |? MarkupContent)
arg1 Maybe [ParameterInformation]
arg2 Maybe UInt
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
"label" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,String
"documentation" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Text |? MarkupContent)
arg1
    ,String
"parameters" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [ParameterInformation]
arg2
    ,String
"activeParameter" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe UInt
arg3]

instance Aeson.FromJSON SignatureInformation where
  parseJSON :: Value -> Parser SignatureInformation
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SignatureInformation" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text
-> Maybe (Text |? MarkupContent)
-> Maybe [ParameterInformation]
-> Maybe UInt
-> SignatureInformation
SignatureInformation forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" 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
"documentation" 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
"parameters" 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
"activeParameter"