{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.CodeAction where
import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson
import qualified Data.Aeson as Aeson
import qualified Data.Row as Row
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.CodeActionKind
import qualified Language.LSP.Protocol.Internal.Types.Command
import qualified Language.LSP.Protocol.Internal.Types.Diagnostic
import qualified Language.LSP.Protocol.Internal.Types.WorkspaceEdit
import qualified Language.LSP.Protocol.Types.Common
data CodeAction = CodeAction
{
CodeAction -> Text
_title :: Data.Text.Text
,
CodeAction -> Maybe CodeActionKind
_kind :: (Maybe Language.LSP.Protocol.Internal.Types.CodeActionKind.CodeActionKind)
,
CodeAction -> Maybe [Diagnostic]
_diagnostics :: (Maybe [Language.LSP.Protocol.Internal.Types.Diagnostic.Diagnostic])
,
CodeAction -> Maybe Bool
_isPreferred :: (Maybe Bool)
,
CodeAction -> Maybe (Rec (Extend "reason" Text ('R '[]) .+ 'R '[]))
_disabled :: (Maybe (Row.Rec ("reason" Row..== Data.Text.Text Row..+ Row.Empty)))
,
CodeAction -> Maybe WorkspaceEdit
_edit :: (Maybe Language.LSP.Protocol.Internal.Types.WorkspaceEdit.WorkspaceEdit)
,
CodeAction -> Maybe Command
_command :: (Maybe Language.LSP.Protocol.Internal.Types.Command.Command)
,
CodeAction -> Maybe Value
_data_ :: (Maybe Data.Aeson.Value)
}
deriving stock (Int -> CodeAction -> ShowS
[CodeAction] -> ShowS
CodeAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeAction] -> ShowS
$cshowList :: [CodeAction] -> ShowS
show :: CodeAction -> String
$cshow :: CodeAction -> String
showsPrec :: Int -> CodeAction -> ShowS
$cshowsPrec :: Int -> CodeAction -> ShowS
Show, CodeAction -> CodeAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeAction -> CodeAction -> Bool
$c/= :: CodeAction -> CodeAction -> Bool
== :: CodeAction -> CodeAction -> Bool
$c== :: CodeAction -> CodeAction -> Bool
Eq, Eq CodeAction
CodeAction -> CodeAction -> Bool
CodeAction -> CodeAction -> Ordering
CodeAction -> CodeAction -> CodeAction
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 :: CodeAction -> CodeAction -> CodeAction
$cmin :: CodeAction -> CodeAction -> CodeAction
max :: CodeAction -> CodeAction -> CodeAction
$cmax :: CodeAction -> CodeAction -> CodeAction
>= :: CodeAction -> CodeAction -> Bool
$c>= :: CodeAction -> CodeAction -> Bool
> :: CodeAction -> CodeAction -> Bool
$c> :: CodeAction -> CodeAction -> Bool
<= :: CodeAction -> CodeAction -> Bool
$c<= :: CodeAction -> CodeAction -> Bool
< :: CodeAction -> CodeAction -> Bool
$c< :: CodeAction -> CodeAction -> Bool
compare :: CodeAction -> CodeAction -> Ordering
$ccompare :: CodeAction -> CodeAction -> Ordering
Ord, forall x. Rep CodeAction x -> CodeAction
forall x. CodeAction -> Rep CodeAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeAction x -> CodeAction
$cfrom :: forall x. CodeAction -> Rep CodeAction x
Generic)
deriving anyclass (CodeAction -> ()
forall a. (a -> ()) -> NFData a
rnf :: CodeAction -> ()
$crnf :: CodeAction -> ()
NFData, Eq CodeAction
Int -> CodeAction -> Int
CodeAction -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CodeAction -> Int
$chash :: CodeAction -> Int
hashWithSalt :: Int -> CodeAction -> Int
$chashWithSalt :: Int -> CodeAction -> Int
Hashable)
deriving forall ann. [CodeAction] -> Doc ann
forall ann. CodeAction -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [CodeAction] -> Doc ann
$cprettyList :: forall ann. [CodeAction] -> Doc ann
pretty :: forall ann. CodeAction -> Doc ann
$cpretty :: forall ann. CodeAction -> Doc ann
Pretty via (ViaJSON CodeAction)
instance Aeson.ToJSON CodeAction where
toJSON :: CodeAction -> Value
toJSON (CodeAction Text
arg0 Maybe CodeActionKind
arg1 Maybe [Diagnostic]
arg2 Maybe Bool
arg3 Maybe (Rec (Extend "reason" Text ('R '[]) .+ 'R '[]))
arg4 Maybe WorkspaceEdit
arg5 Maybe Command
arg6 Maybe Value
arg7) = [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
"title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
,String
"kind" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe CodeActionKind
arg1
,String
"diagnostics" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [Diagnostic]
arg2
,String
"isPreferred" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg3
,String
"disabled" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Rec (Extend "reason" Text ('R '[]) .+ 'R '[]))
arg4
,String
"edit" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe WorkspaceEdit
arg5
,String
"command" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Command
arg6
,String
"data" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Value
arg7]
instance Aeson.FromJSON CodeAction where
parseJSON :: Value -> Parser CodeAction
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CodeAction" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text
-> Maybe CodeActionKind
-> Maybe [Diagnostic]
-> Maybe Bool
-> Maybe (Rec (Extend "reason" Text ('R '[]) .+ 'R '[]))
-> Maybe WorkspaceEdit
-> Maybe Command
-> Maybe Value
-> CodeAction
CodeAction forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"title" 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
"kind" 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
"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
"isPreferred" 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
"disabled" 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
"edit" 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
"command" 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
"data"