{- ORMOLU_DISABLE -}
{- HLINT ignore -}
-- THIS IS A GENERATED FILE, DO NOT EDIT

{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.CodeActionParams 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.CodeActionContext
import qualified Language.LSP.Protocol.Internal.Types.ProgressToken
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier
import qualified Language.LSP.Protocol.Types.Common

{-|
The parameters of a `CodeActionRequest`.
-}
data CodeActionParams = CodeActionParams 
  { {-|
  An optional token that a server can use to report work done progress.
  -}
  CodeActionParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  An optional token that a server can use to report partial results (e.g. streaming) to
  the client.
  -}
  CodeActionParams -> Maybe ProgressToken
_partialResultToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The document in which the command was invoked.
  -}
  CodeActionParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The range for which the command was invoked.
  -}
  CodeActionParams -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  Context carrying additional information.
  -}
  CodeActionParams -> CodeActionContext
_context :: Language.LSP.Protocol.Internal.Types.CodeActionContext.CodeActionContext
  }
  deriving stock (Int -> CodeActionParams -> ShowS
[CodeActionParams] -> ShowS
CodeActionParams -> String
(Int -> CodeActionParams -> ShowS)
-> (CodeActionParams -> String)
-> ([CodeActionParams] -> ShowS)
-> Show CodeActionParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeActionParams -> ShowS
showsPrec :: Int -> CodeActionParams -> ShowS
$cshow :: CodeActionParams -> String
show :: CodeActionParams -> String
$cshowList :: [CodeActionParams] -> ShowS
showList :: [CodeActionParams] -> ShowS
Show, CodeActionParams -> CodeActionParams -> Bool
(CodeActionParams -> CodeActionParams -> Bool)
-> (CodeActionParams -> CodeActionParams -> Bool)
-> Eq CodeActionParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CodeActionParams -> CodeActionParams -> Bool
== :: CodeActionParams -> CodeActionParams -> Bool
$c/= :: CodeActionParams -> CodeActionParams -> Bool
/= :: CodeActionParams -> CodeActionParams -> Bool
Eq, Eq CodeActionParams
Eq CodeActionParams =>
(CodeActionParams -> CodeActionParams -> Ordering)
-> (CodeActionParams -> CodeActionParams -> Bool)
-> (CodeActionParams -> CodeActionParams -> Bool)
-> (CodeActionParams -> CodeActionParams -> Bool)
-> (CodeActionParams -> CodeActionParams -> Bool)
-> (CodeActionParams -> CodeActionParams -> CodeActionParams)
-> (CodeActionParams -> CodeActionParams -> CodeActionParams)
-> Ord CodeActionParams
CodeActionParams -> CodeActionParams -> Bool
CodeActionParams -> CodeActionParams -> Ordering
CodeActionParams -> CodeActionParams -> CodeActionParams
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 :: CodeActionParams -> CodeActionParams -> Ordering
compare :: CodeActionParams -> CodeActionParams -> Ordering
$c< :: CodeActionParams -> CodeActionParams -> Bool
< :: CodeActionParams -> CodeActionParams -> Bool
$c<= :: CodeActionParams -> CodeActionParams -> Bool
<= :: CodeActionParams -> CodeActionParams -> Bool
$c> :: CodeActionParams -> CodeActionParams -> Bool
> :: CodeActionParams -> CodeActionParams -> Bool
$c>= :: CodeActionParams -> CodeActionParams -> Bool
>= :: CodeActionParams -> CodeActionParams -> Bool
$cmax :: CodeActionParams -> CodeActionParams -> CodeActionParams
max :: CodeActionParams -> CodeActionParams -> CodeActionParams
$cmin :: CodeActionParams -> CodeActionParams -> CodeActionParams
min :: CodeActionParams -> CodeActionParams -> CodeActionParams
Ord, (forall x. CodeActionParams -> Rep CodeActionParams x)
-> (forall x. Rep CodeActionParams x -> CodeActionParams)
-> Generic CodeActionParams
forall x. Rep CodeActionParams x -> CodeActionParams
forall x. CodeActionParams -> Rep CodeActionParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CodeActionParams -> Rep CodeActionParams x
from :: forall x. CodeActionParams -> Rep CodeActionParams x
$cto :: forall x. Rep CodeActionParams x -> CodeActionParams
to :: forall x. Rep CodeActionParams x -> CodeActionParams
Generic)
  deriving anyclass (CodeActionParams -> ()
(CodeActionParams -> ()) -> NFData CodeActionParams
forall a. (a -> ()) -> NFData a
$crnf :: CodeActionParams -> ()
rnf :: CodeActionParams -> ()
NFData, Eq CodeActionParams
Eq CodeActionParams =>
(Int -> CodeActionParams -> Int)
-> (CodeActionParams -> Int) -> Hashable CodeActionParams
Int -> CodeActionParams -> Int
CodeActionParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> CodeActionParams -> Int
hashWithSalt :: Int -> CodeActionParams -> Int
$chash :: CodeActionParams -> Int
hash :: CodeActionParams -> Int
Hashable)
  deriving (forall ann. CodeActionParams -> Doc ann)
-> (forall ann. [CodeActionParams] -> Doc ann)
-> Pretty CodeActionParams
forall ann. [CodeActionParams] -> Doc ann
forall ann. CodeActionParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. CodeActionParams -> Doc ann
pretty :: forall ann. CodeActionParams -> Doc ann
$cprettyList :: forall ann. [CodeActionParams] -> Doc ann
prettyList :: forall ann. [CodeActionParams] -> Doc ann
Pretty via (ViaJSON CodeActionParams)

instance Aeson.ToJSON CodeActionParams where
  toJSON :: CodeActionParams -> Value
toJSON (CodeActionParams Maybe ProgressToken
arg0 Maybe ProgressToken
arg1 TextDocumentIdentifier
arg2 Range
arg3 CodeActionContext
arg4) = [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
$  [String
"workDoneToken" String -> Maybe ProgressToken -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
    ,String
"partialResultToken" String -> Maybe ProgressToken -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg1
    ,[Key
"textDocument" Key -> TextDocumentIdentifier -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg2]
    ,[Key
"range" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg3]
    ,[Key
"context" Key -> CodeActionContext -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= CodeActionContext
arg4]]

instance Aeson.FromJSON CodeActionParams where
  parseJSON :: Value -> Parser CodeActionParams
parseJSON = String
-> (Object -> Parser CodeActionParams)
-> Value
-> Parser CodeActionParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CodeActionParams" ((Object -> Parser CodeActionParams)
 -> Value -> Parser CodeActionParams)
-> (Object -> Parser CodeActionParams)
-> Value
-> Parser CodeActionParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> Maybe ProgressToken
-> TextDocumentIdentifier
-> Range
-> CodeActionContext
-> CodeActionParams
CodeActionParams (Maybe ProgressToken
 -> Maybe ProgressToken
 -> TextDocumentIdentifier
 -> Range
 -> CodeActionContext
 -> CodeActionParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (Maybe ProgressToken
      -> TextDocumentIdentifier
      -> Range
      -> CodeActionContext
      -> CodeActionParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"workDoneToken" Parser
  (Maybe ProgressToken
   -> TextDocumentIdentifier
   -> Range
   -> CodeActionContext
   -> CodeActionParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (TextDocumentIdentifier
      -> Range -> CodeActionContext -> CodeActionParams)
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 ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"partialResultToken" Parser
  (TextDocumentIdentifier
   -> Range -> CodeActionContext -> CodeActionParams)
-> Parser TextDocumentIdentifier
-> Parser (Range -> CodeActionContext -> CodeActionParams)
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 TextDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument" Parser (Range -> CodeActionContext -> CodeActionParams)
-> Parser Range -> Parser (CodeActionContext -> CodeActionParams)
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 Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" Parser (CodeActionContext -> CodeActionParams)
-> Parser CodeActionContext -> Parser CodeActionParams
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 CodeActionContext
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"context"