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