{- 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.ParameterInformation 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 Data.Text
import qualified Language.LSP.Protocol.Internal.Types.MarkupContent
import qualified Language.LSP.Protocol.Types.Common

{-|
Represents a parameter of a callable-signature. A parameter can
have a label and a doc-comment.
-}
data ParameterInformation = ParameterInformation 
  { {-|
  The label of this parameter information.

  Either a string or an inclusive start and exclusive end offsets within its containing
  signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
  string representation as `Position` and `Range` does.

  *Note*: a label of type string should be a substring of its containing signature label.
  Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
  -}
  ParameterInformation -> Text |? (UInt, UInt)
_label :: (Data.Text.Text Language.LSP.Protocol.Types.Common.|? ( Language.LSP.Protocol.Types.Common.UInt
  , Language.LSP.Protocol.Types.Common.UInt ))
  , {-|
  The human-readable doc-comment of this parameter. Will be shown
  in the UI but can be omitted.
  -}
  ParameterInformation -> Maybe (Text |? MarkupContent)
_documentation :: (Maybe (Data.Text.Text Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.MarkupContent.MarkupContent))
  }
  deriving stock (Int -> ParameterInformation -> ShowS
[ParameterInformation] -> ShowS
ParameterInformation -> String
(Int -> ParameterInformation -> ShowS)
-> (ParameterInformation -> String)
-> ([ParameterInformation] -> ShowS)
-> Show ParameterInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParameterInformation -> ShowS
showsPrec :: Int -> ParameterInformation -> ShowS
$cshow :: ParameterInformation -> String
show :: ParameterInformation -> String
$cshowList :: [ParameterInformation] -> ShowS
showList :: [ParameterInformation] -> ShowS
Show, ParameterInformation -> ParameterInformation -> Bool
(ParameterInformation -> ParameterInformation -> Bool)
-> (ParameterInformation -> ParameterInformation -> Bool)
-> Eq ParameterInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ParameterInformation -> ParameterInformation -> Bool
== :: ParameterInformation -> ParameterInformation -> Bool
$c/= :: ParameterInformation -> ParameterInformation -> Bool
/= :: ParameterInformation -> ParameterInformation -> Bool
Eq, Eq ParameterInformation
Eq ParameterInformation =>
(ParameterInformation -> ParameterInformation -> Ordering)
-> (ParameterInformation -> ParameterInformation -> Bool)
-> (ParameterInformation -> ParameterInformation -> Bool)
-> (ParameterInformation -> ParameterInformation -> Bool)
-> (ParameterInformation -> ParameterInformation -> Bool)
-> (ParameterInformation
    -> ParameterInformation -> ParameterInformation)
-> (ParameterInformation
    -> ParameterInformation -> ParameterInformation)
-> Ord ParameterInformation
ParameterInformation -> ParameterInformation -> Bool
ParameterInformation -> ParameterInformation -> Ordering
ParameterInformation
-> ParameterInformation -> ParameterInformation
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 :: ParameterInformation -> ParameterInformation -> Ordering
compare :: ParameterInformation -> ParameterInformation -> Ordering
$c< :: ParameterInformation -> ParameterInformation -> Bool
< :: ParameterInformation -> ParameterInformation -> Bool
$c<= :: ParameterInformation -> ParameterInformation -> Bool
<= :: ParameterInformation -> ParameterInformation -> Bool
$c> :: ParameterInformation -> ParameterInformation -> Bool
> :: ParameterInformation -> ParameterInformation -> Bool
$c>= :: ParameterInformation -> ParameterInformation -> Bool
>= :: ParameterInformation -> ParameterInformation -> Bool
$cmax :: ParameterInformation
-> ParameterInformation -> ParameterInformation
max :: ParameterInformation
-> ParameterInformation -> ParameterInformation
$cmin :: ParameterInformation
-> ParameterInformation -> ParameterInformation
min :: ParameterInformation
-> ParameterInformation -> ParameterInformation
Ord, (forall x. ParameterInformation -> Rep ParameterInformation x)
-> (forall x. Rep ParameterInformation x -> ParameterInformation)
-> Generic ParameterInformation
forall x. Rep ParameterInformation x -> ParameterInformation
forall x. ParameterInformation -> Rep ParameterInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ParameterInformation -> Rep ParameterInformation x
from :: forall x. ParameterInformation -> Rep ParameterInformation x
$cto :: forall x. Rep ParameterInformation x -> ParameterInformation
to :: forall x. Rep ParameterInformation x -> ParameterInformation
Generic)
  deriving anyclass (ParameterInformation -> ()
(ParameterInformation -> ()) -> NFData ParameterInformation
forall a. (a -> ()) -> NFData a
$crnf :: ParameterInformation -> ()
rnf :: ParameterInformation -> ()
NFData, Eq ParameterInformation
Eq ParameterInformation =>
(Int -> ParameterInformation -> Int)
-> (ParameterInformation -> Int) -> Hashable ParameterInformation
Int -> ParameterInformation -> Int
ParameterInformation -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> ParameterInformation -> Int
hashWithSalt :: Int -> ParameterInformation -> Int
$chash :: ParameterInformation -> Int
hash :: ParameterInformation -> Int
Hashable)
  deriving (forall ann. ParameterInformation -> Doc ann)
-> (forall ann. [ParameterInformation] -> Doc ann)
-> Pretty ParameterInformation
forall ann. [ParameterInformation] -> Doc ann
forall ann. ParameterInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. ParameterInformation -> Doc ann
pretty :: forall ann. ParameterInformation -> Doc ann
$cprettyList :: forall ann. [ParameterInformation] -> Doc ann
prettyList :: forall ann. [ParameterInformation] -> Doc ann
Pretty via (ViaJSON ParameterInformation)

instance Aeson.ToJSON ParameterInformation where
  toJSON :: ParameterInformation -> Value
toJSON (ParameterInformation Text |? (UInt, UInt)
arg0 Maybe (Text |? MarkupContent)
arg1) = [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
$  [[Key
"label" Key -> (Text |? (UInt, UInt)) -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text |? (UInt, UInt)
arg0]
    ,String
"documentation" String -> Maybe (Text |? MarkupContent) -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Text |? MarkupContent)
arg1]

instance Aeson.FromJSON ParameterInformation where
  parseJSON :: Value -> Parser ParameterInformation
parseJSON = String
-> (Object -> Parser ParameterInformation)
-> Value
-> Parser ParameterInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ParameterInformation" ((Object -> Parser ParameterInformation)
 -> Value -> Parser ParameterInformation)
-> (Object -> Parser ParameterInformation)
-> Value
-> Parser ParameterInformation
forall a b. (a -> b) -> a -> b
$ \Object
arg -> (Text |? (UInt, UInt))
-> Maybe (Text |? MarkupContent) -> ParameterInformation
ParameterInformation ((Text |? (UInt, UInt))
 -> Maybe (Text |? MarkupContent) -> ParameterInformation)
-> Parser (Text |? (UInt, UInt))
-> Parser (Maybe (Text |? MarkupContent) -> ParameterInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Text |? (UInt, UInt))
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" Parser (Maybe (Text |? MarkupContent) -> ParameterInformation)
-> Parser (Maybe (Text |? MarkupContent))
-> Parser ParameterInformation
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 (Text |? MarkupContent))
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"documentation"