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