{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterInformation] -> ShowS
$cshowList :: [ParameterInformation] -> ShowS
show :: ParameterInformation -> String
$cshow :: ParameterInformation -> String
showsPrec :: Int -> ParameterInformation -> ShowS
$cshowsPrec :: Int -> ParameterInformation -> ShowS
Show, ParameterInformation -> ParameterInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterInformation -> ParameterInformation -> Bool
$c/= :: ParameterInformation -> ParameterInformation -> Bool
== :: ParameterInformation -> ParameterInformation -> Bool
$c== :: ParameterInformation -> ParameterInformation -> Bool
Eq, Eq 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
min :: ParameterInformation
-> ParameterInformation -> ParameterInformation
$cmin :: ParameterInformation
-> ParameterInformation -> ParameterInformation
max :: ParameterInformation
-> ParameterInformation -> ParameterInformation
$cmax :: ParameterInformation
-> ParameterInformation -> ParameterInformation
>= :: ParameterInformation -> ParameterInformation -> Bool
$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
compare :: ParameterInformation -> ParameterInformation -> Ordering
$ccompare :: ParameterInformation -> ParameterInformation -> Ordering
Ord, 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
$cto :: forall x. Rep ParameterInformation x -> ParameterInformation
$cfrom :: forall x. ParameterInformation -> Rep ParameterInformation x
Generic)
  deriving anyclass (ParameterInformation -> ()
forall a. (a -> ()) -> NFData a
rnf :: ParameterInformation -> ()
$crnf :: ParameterInformation -> ()
NFData, Eq ParameterInformation
Int -> ParameterInformation -> Int
ParameterInformation -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ParameterInformation -> Int
$chash :: ParameterInformation -> Int
hashWithSalt :: Int -> ParameterInformation -> Int
$chashWithSalt :: Int -> ParameterInformation -> Int
Hashable)
  deriving forall ann. [ParameterInformation] -> Doc ann
forall ann. ParameterInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [ParameterInformation] -> Doc ann
$cprettyList :: forall ann. [ParameterInformation] -> Doc ann
pretty :: forall ann. ParameterInformation -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [[Key
"label" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text |? (UInt, UInt)
arg0]
    ,String
"documentation" forall kv v. (KeyValue 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 = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ParameterInformation" forall a b. (a -> b) -> a -> b
$ \Object
arg -> (Text |? (UInt, UInt))
-> Maybe (Text |? MarkupContent) -> ParameterInformation
ParameterInformation forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" 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
"documentation"