{-# 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
data SignatureInformation = SignatureInformation
{
SignatureInformation -> Text
_label :: Data.Text.Text
,
SignatureInformation -> Maybe (Text |? MarkupContent)
_documentation :: (Maybe (Data.Text.Text Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.MarkupContent.MarkupContent))
,
SignatureInformation -> Maybe [ParameterInformation]
_parameters :: (Maybe [Language.LSP.Protocol.Internal.Types.ParameterInformation.ParameterInformation])
,
SignatureInformation -> Maybe (UInt |? Null)
_activeParameter :: (Maybe (Language.LSP.Protocol.Types.Common.UInt Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Types.Common.Null))
}
deriving stock (Int -> SignatureInformation -> ShowS
[SignatureInformation] -> ShowS
SignatureInformation -> String
(Int -> SignatureInformation -> ShowS)
-> (SignatureInformation -> String)
-> ([SignatureInformation] -> ShowS)
-> Show SignatureInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SignatureInformation -> ShowS
showsPrec :: Int -> SignatureInformation -> ShowS
$cshow :: SignatureInformation -> String
show :: SignatureInformation -> String
$cshowList :: [SignatureInformation] -> ShowS
showList :: [SignatureInformation] -> ShowS
Show, SignatureInformation -> SignatureInformation -> Bool
(SignatureInformation -> SignatureInformation -> Bool)
-> (SignatureInformation -> SignatureInformation -> Bool)
-> Eq SignatureInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SignatureInformation -> SignatureInformation -> Bool
== :: SignatureInformation -> SignatureInformation -> Bool
$c/= :: SignatureInformation -> SignatureInformation -> Bool
/= :: SignatureInformation -> SignatureInformation -> Bool
Eq, Eq SignatureInformation
Eq SignatureInformation =>
(SignatureInformation -> SignatureInformation -> Ordering)
-> (SignatureInformation -> SignatureInformation -> Bool)
-> (SignatureInformation -> SignatureInformation -> Bool)
-> (SignatureInformation -> SignatureInformation -> Bool)
-> (SignatureInformation -> SignatureInformation -> Bool)
-> (SignatureInformation
-> SignatureInformation -> SignatureInformation)
-> (SignatureInformation
-> SignatureInformation -> SignatureInformation)
-> Ord 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
$ccompare :: SignatureInformation -> SignatureInformation -> Ordering
compare :: SignatureInformation -> SignatureInformation -> Ordering
$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
>= :: SignatureInformation -> SignatureInformation -> Bool
$cmax :: SignatureInformation
-> SignatureInformation -> SignatureInformation
max :: SignatureInformation
-> SignatureInformation -> SignatureInformation
$cmin :: SignatureInformation
-> SignatureInformation -> SignatureInformation
min :: SignatureInformation
-> SignatureInformation -> SignatureInformation
Ord, (forall x. SignatureInformation -> Rep SignatureInformation x)
-> (forall x. Rep SignatureInformation x -> SignatureInformation)
-> Generic SignatureInformation
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
$cfrom :: forall x. SignatureInformation -> Rep SignatureInformation x
from :: forall x. SignatureInformation -> Rep SignatureInformation x
$cto :: forall x. Rep SignatureInformation x -> SignatureInformation
to :: forall x. Rep SignatureInformation x -> SignatureInformation
Generic)
deriving anyclass (SignatureInformation -> ()
(SignatureInformation -> ()) -> NFData SignatureInformation
forall a. (a -> ()) -> NFData a
$crnf :: SignatureInformation -> ()
rnf :: SignatureInformation -> ()
NFData, Eq SignatureInformation
Eq SignatureInformation =>
(Int -> SignatureInformation -> Int)
-> (SignatureInformation -> Int) -> Hashable SignatureInformation
Int -> SignatureInformation -> Int
SignatureInformation -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> SignatureInformation -> Int
hashWithSalt :: Int -> SignatureInformation -> Int
$chash :: SignatureInformation -> Int
hash :: SignatureInformation -> Int
Hashable)
deriving (forall ann. SignatureInformation -> Doc ann)
-> (forall ann. [SignatureInformation] -> Doc ann)
-> Pretty SignatureInformation
forall ann. [SignatureInformation] -> Doc ann
forall ann. SignatureInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. SignatureInformation -> Doc ann
pretty :: forall ann. SignatureInformation -> Doc ann
$cprettyList :: forall ann. [SignatureInformation] -> Doc ann
prettyList :: 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 |? Null)
arg3) = [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
$ [[Key
"label" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
,String
"documentation" String -> Maybe (Text |? MarkupContent) -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Text |? MarkupContent)
arg1
,String
"parameters" String -> Maybe [ParameterInformation] -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [ParameterInformation]
arg2
,String
"activeParameter" String -> Maybe (UInt |? Null) -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (UInt |? Null)
arg3]
instance Aeson.FromJSON SignatureInformation where
parseJSON :: Value -> Parser SignatureInformation
parseJSON = String
-> (Object -> Parser SignatureInformation)
-> Value
-> Parser SignatureInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SignatureInformation" ((Object -> Parser SignatureInformation)
-> Value -> Parser SignatureInformation)
-> (Object -> Parser SignatureInformation)
-> Value
-> Parser SignatureInformation
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text
-> Maybe (Text |? MarkupContent)
-> Maybe [ParameterInformation]
-> Maybe (UInt |? Null)
-> SignatureInformation
SignatureInformation (Text
-> Maybe (Text |? MarkupContent)
-> Maybe [ParameterInformation]
-> Maybe (UInt |? Null)
-> SignatureInformation)
-> Parser Text
-> Parser
(Maybe (Text |? MarkupContent)
-> Maybe [ParameterInformation]
-> Maybe (UInt |? Null)
-> SignatureInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" Parser
(Maybe (Text |? MarkupContent)
-> Maybe [ParameterInformation]
-> Maybe (UInt |? Null)
-> SignatureInformation)
-> Parser (Maybe (Text |? MarkupContent))
-> Parser
(Maybe [ParameterInformation]
-> Maybe (UInt |? Null) -> SignatureInformation)
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 (Maybe (Text |? MarkupContent))
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"documentation" Parser
(Maybe [ParameterInformation]
-> Maybe (UInt |? Null) -> SignatureInformation)
-> Parser (Maybe [ParameterInformation])
-> Parser (Maybe (UInt |? Null) -> SignatureInformation)
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 (Maybe [ParameterInformation])
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"parameters" Parser (Maybe (UInt |? Null) -> SignatureInformation)
-> Parser (Maybe (UInt |? Null)) -> Parser SignatureInformation
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 (Maybe (UInt |? Null))
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"activeParameter"