{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.SignatureHelp 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.SignatureInformation
import qualified Language.LSP.Protocol.Types.Common
data SignatureHelp = SignatureHelp
{
SignatureHelp -> [SignatureInformation]
_signatures :: [Language.LSP.Protocol.Internal.Types.SignatureInformation.SignatureInformation]
,
SignatureHelp -> Maybe UInt
_activeSignature :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
,
SignatureHelp -> Maybe UInt
_activeParameter :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
}
deriving stock (Int -> SignatureHelp -> ShowS
[SignatureHelp] -> ShowS
SignatureHelp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SignatureHelp] -> ShowS
$cshowList :: [SignatureHelp] -> ShowS
show :: SignatureHelp -> String
$cshow :: SignatureHelp -> String
showsPrec :: Int -> SignatureHelp -> ShowS
$cshowsPrec :: Int -> SignatureHelp -> ShowS
Show, SignatureHelp -> SignatureHelp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SignatureHelp -> SignatureHelp -> Bool
$c/= :: SignatureHelp -> SignatureHelp -> Bool
== :: SignatureHelp -> SignatureHelp -> Bool
$c== :: SignatureHelp -> SignatureHelp -> Bool
Eq, Eq SignatureHelp
SignatureHelp -> SignatureHelp -> Bool
SignatureHelp -> SignatureHelp -> Ordering
SignatureHelp -> SignatureHelp -> SignatureHelp
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 :: SignatureHelp -> SignatureHelp -> SignatureHelp
$cmin :: SignatureHelp -> SignatureHelp -> SignatureHelp
max :: SignatureHelp -> SignatureHelp -> SignatureHelp
$cmax :: SignatureHelp -> SignatureHelp -> SignatureHelp
>= :: SignatureHelp -> SignatureHelp -> Bool
$c>= :: SignatureHelp -> SignatureHelp -> Bool
> :: SignatureHelp -> SignatureHelp -> Bool
$c> :: SignatureHelp -> SignatureHelp -> Bool
<= :: SignatureHelp -> SignatureHelp -> Bool
$c<= :: SignatureHelp -> SignatureHelp -> Bool
< :: SignatureHelp -> SignatureHelp -> Bool
$c< :: SignatureHelp -> SignatureHelp -> Bool
compare :: SignatureHelp -> SignatureHelp -> Ordering
$ccompare :: SignatureHelp -> SignatureHelp -> Ordering
Ord, forall x. Rep SignatureHelp x -> SignatureHelp
forall x. SignatureHelp -> Rep SignatureHelp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SignatureHelp x -> SignatureHelp
$cfrom :: forall x. SignatureHelp -> Rep SignatureHelp x
Generic)
deriving anyclass (SignatureHelp -> ()
forall a. (a -> ()) -> NFData a
rnf :: SignatureHelp -> ()
$crnf :: SignatureHelp -> ()
NFData, Eq SignatureHelp
Int -> SignatureHelp -> Int
SignatureHelp -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SignatureHelp -> Int
$chash :: SignatureHelp -> Int
hashWithSalt :: Int -> SignatureHelp -> Int
$chashWithSalt :: Int -> SignatureHelp -> Int
Hashable)
deriving forall ann. [SignatureHelp] -> Doc ann
forall ann. SignatureHelp -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [SignatureHelp] -> Doc ann
$cprettyList :: forall ann. [SignatureHelp] -> Doc ann
pretty :: forall ann. SignatureHelp -> Doc ann
$cpretty :: forall ann. SignatureHelp -> Doc ann
Pretty via (ViaJSON SignatureHelp)
instance Aeson.ToJSON SignatureHelp where
toJSON :: SignatureHelp -> Value
toJSON (SignatureHelp [SignatureInformation]
arg0 Maybe UInt
arg1 Maybe UInt
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
$ [[Key
"signatures" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= [SignatureInformation]
arg0]
,String
"activeSignature" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe UInt
arg1
,String
"activeParameter" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe UInt
arg2]
instance Aeson.FromJSON SignatureHelp where
parseJSON :: Value -> Parser SignatureHelp
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SignatureHelp" forall a b. (a -> b) -> a -> b
$ \Object
arg -> [SignatureInformation] -> Maybe UInt -> Maybe UInt -> SignatureHelp
SignatureHelp forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"signatures" 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
"activeSignature" 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"