{- 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.GeneralClientCapabilities 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 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.MarkdownClientCapabilities
import qualified Language.LSP.Protocol.Internal.Types.PositionEncodingKind
import qualified Language.LSP.Protocol.Internal.Types.RegularExpressionsClientCapabilities
import qualified Language.LSP.Protocol.Types.Common

{-|
General client capabilities.

@since 3.16.0
-}
data GeneralClientCapabilities = GeneralClientCapabilities 
  { {-|
  Client capability that signals how the client
  handles stale requests (e.g. a request
  for which the client will not process the response
  anymore since the information is outdated).

  @since 3.17.0
  -}
  GeneralClientCapabilities
-> Maybe
     (Rec
        (("cancel" .== Bool)
         .+ (Extend "retryOnContentModified" [Text] ('R '[]) .+ 'R '[])))
_staleRequestSupport :: (Maybe (Row.Rec ("cancel" Row..== Bool Row..+ ("retryOnContentModified" Row..== [Data.Text.Text] Row..+ Row.Empty))))
  , {-|
  Client capabilities specific to regular expressions.

  @since 3.16.0
  -}
  GeneralClientCapabilities
-> Maybe RegularExpressionsClientCapabilities
_regularExpressions :: (Maybe Language.LSP.Protocol.Internal.Types.RegularExpressionsClientCapabilities.RegularExpressionsClientCapabilities)
  , {-|
  Client capabilities specific to the client's markdown parser.

  @since 3.16.0
  -}
  GeneralClientCapabilities -> Maybe MarkdownClientCapabilities
_markdown :: (Maybe Language.LSP.Protocol.Internal.Types.MarkdownClientCapabilities.MarkdownClientCapabilities)
  , {-|
  The position encodings supported by the client. Client and server
  have to agree on the same position encoding to ensure that offsets
  (e.g. character position in a line) are interpreted the same on both
  sides.

  To keep the protocol backwards compatible the following applies: if
  the value 'utf-16' is missing from the array of position encodings
  servers can assume that the client supports UTF-16. UTF-16 is
  therefore a mandatory encoding.

  If omitted it defaults to ['utf-16'].

  Implementation considerations: since the conversion from one encoding
  into another requires the content of the file / line the conversion
  is best done where the file is read which is usually on the server
  side.

  @since 3.17.0
  -}
  GeneralClientCapabilities -> Maybe [PositionEncodingKind]
_positionEncodings :: (Maybe [Language.LSP.Protocol.Internal.Types.PositionEncodingKind.PositionEncodingKind])
  }
  deriving stock (Int -> GeneralClientCapabilities -> ShowS
[GeneralClientCapabilities] -> ShowS
GeneralClientCapabilities -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeneralClientCapabilities] -> ShowS
$cshowList :: [GeneralClientCapabilities] -> ShowS
show :: GeneralClientCapabilities -> String
$cshow :: GeneralClientCapabilities -> String
showsPrec :: Int -> GeneralClientCapabilities -> ShowS
$cshowsPrec :: Int -> GeneralClientCapabilities -> ShowS
Show, GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
$c/= :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
== :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
$c== :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
Eq, Eq GeneralClientCapabilities
GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
GeneralClientCapabilities -> GeneralClientCapabilities -> Ordering
GeneralClientCapabilities
-> GeneralClientCapabilities -> GeneralClientCapabilities
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 :: GeneralClientCapabilities
-> GeneralClientCapabilities -> GeneralClientCapabilities
$cmin :: GeneralClientCapabilities
-> GeneralClientCapabilities -> GeneralClientCapabilities
max :: GeneralClientCapabilities
-> GeneralClientCapabilities -> GeneralClientCapabilities
$cmax :: GeneralClientCapabilities
-> GeneralClientCapabilities -> GeneralClientCapabilities
>= :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
$c>= :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
> :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
$c> :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
<= :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
$c<= :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
< :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
$c< :: GeneralClientCapabilities -> GeneralClientCapabilities -> Bool
compare :: GeneralClientCapabilities -> GeneralClientCapabilities -> Ordering
$ccompare :: GeneralClientCapabilities -> GeneralClientCapabilities -> Ordering
Ord, forall x.
Rep GeneralClientCapabilities x -> GeneralClientCapabilities
forall x.
GeneralClientCapabilities -> Rep GeneralClientCapabilities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GeneralClientCapabilities x -> GeneralClientCapabilities
$cfrom :: forall x.
GeneralClientCapabilities -> Rep GeneralClientCapabilities x
Generic)
  deriving anyclass (GeneralClientCapabilities -> ()
forall a. (a -> ()) -> NFData a
rnf :: GeneralClientCapabilities -> ()
$crnf :: GeneralClientCapabilities -> ()
NFData, Eq GeneralClientCapabilities
Int -> GeneralClientCapabilities -> Int
GeneralClientCapabilities -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: GeneralClientCapabilities -> Int
$chash :: GeneralClientCapabilities -> Int
hashWithSalt :: Int -> GeneralClientCapabilities -> Int
$chashWithSalt :: Int -> GeneralClientCapabilities -> Int
Hashable)
  deriving forall ann. [GeneralClientCapabilities] -> Doc ann
forall ann. GeneralClientCapabilities -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [GeneralClientCapabilities] -> Doc ann
$cprettyList :: forall ann. [GeneralClientCapabilities] -> Doc ann
pretty :: forall ann. GeneralClientCapabilities -> Doc ann
$cpretty :: forall ann. GeneralClientCapabilities -> Doc ann
Pretty via (ViaJSON GeneralClientCapabilities)

instance Aeson.ToJSON GeneralClientCapabilities where
  toJSON :: GeneralClientCapabilities -> Value
toJSON (GeneralClientCapabilities Maybe
  (Rec
     (("cancel" .== Bool)
      .+ (Extend "retryOnContentModified" [Text] ('R '[]) .+ 'R '[])))
arg0 Maybe RegularExpressionsClientCapabilities
arg1 Maybe MarkdownClientCapabilities
arg2 Maybe [PositionEncodingKind]
arg3) = [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
$  [String
"staleRequestSupport" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe
  (Rec
     (("cancel" .== Bool)
      .+ (Extend "retryOnContentModified" [Text] ('R '[]) .+ 'R '[])))
arg0
    ,String
"regularExpressions" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe RegularExpressionsClientCapabilities
arg1
    ,String
"markdown" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe MarkdownClientCapabilities
arg2
    ,String
"positionEncodings" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [PositionEncodingKind]
arg3]

instance Aeson.FromJSON GeneralClientCapabilities where
  parseJSON :: Value -> Parser GeneralClientCapabilities
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"GeneralClientCapabilities" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe
  (Rec
     (("cancel" .== Bool)
      .+ (Extend "retryOnContentModified" [Text] ('R '[]) .+ 'R '[])))
-> Maybe RegularExpressionsClientCapabilities
-> Maybe MarkdownClientCapabilities
-> Maybe [PositionEncodingKind]
-> GeneralClientCapabilities
GeneralClientCapabilities forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"staleRequestSupport" 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
"regularExpressions" 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
"markdown" 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
"positionEncodings"