{- 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.LinkedEditingRanges 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.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
The result of a linked editing range request.

@since 3.16.0
-}
data LinkedEditingRanges = LinkedEditingRanges 
  { {-|
  A list of ranges that can be edited together. The ranges must have
  identical length and contain identical text content. The ranges cannot overlap.
  -}
  LinkedEditingRanges -> [Range]
_ranges :: [Language.LSP.Protocol.Internal.Types.Range.Range]
  , {-|
  An optional word pattern (regular expression) that describes valid contents for
  the given ranges. If no pattern is provided, the client configuration's word
  pattern will be used.
  -}
  LinkedEditingRanges -> Maybe Text
_wordPattern :: (Maybe Data.Text.Text)
  }
  deriving stock (Int -> LinkedEditingRanges -> ShowS
[LinkedEditingRanges] -> ShowS
LinkedEditingRanges -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LinkedEditingRanges] -> ShowS
$cshowList :: [LinkedEditingRanges] -> ShowS
show :: LinkedEditingRanges -> String
$cshow :: LinkedEditingRanges -> String
showsPrec :: Int -> LinkedEditingRanges -> ShowS
$cshowsPrec :: Int -> LinkedEditingRanges -> ShowS
Show, LinkedEditingRanges -> LinkedEditingRanges -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
$c/= :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
== :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
$c== :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
Eq, Eq LinkedEditingRanges
LinkedEditingRanges -> LinkedEditingRanges -> Bool
LinkedEditingRanges -> LinkedEditingRanges -> Ordering
LinkedEditingRanges -> LinkedEditingRanges -> LinkedEditingRanges
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 :: LinkedEditingRanges -> LinkedEditingRanges -> LinkedEditingRanges
$cmin :: LinkedEditingRanges -> LinkedEditingRanges -> LinkedEditingRanges
max :: LinkedEditingRanges -> LinkedEditingRanges -> LinkedEditingRanges
$cmax :: LinkedEditingRanges -> LinkedEditingRanges -> LinkedEditingRanges
>= :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
$c>= :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
> :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
$c> :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
<= :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
$c<= :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
< :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
$c< :: LinkedEditingRanges -> LinkedEditingRanges -> Bool
compare :: LinkedEditingRanges -> LinkedEditingRanges -> Ordering
$ccompare :: LinkedEditingRanges -> LinkedEditingRanges -> Ordering
Ord, forall x. Rep LinkedEditingRanges x -> LinkedEditingRanges
forall x. LinkedEditingRanges -> Rep LinkedEditingRanges x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LinkedEditingRanges x -> LinkedEditingRanges
$cfrom :: forall x. LinkedEditingRanges -> Rep LinkedEditingRanges x
Generic)
  deriving anyclass (LinkedEditingRanges -> ()
forall a. (a -> ()) -> NFData a
rnf :: LinkedEditingRanges -> ()
$crnf :: LinkedEditingRanges -> ()
NFData, Eq LinkedEditingRanges
Int -> LinkedEditingRanges -> Int
LinkedEditingRanges -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: LinkedEditingRanges -> Int
$chash :: LinkedEditingRanges -> Int
hashWithSalt :: Int -> LinkedEditingRanges -> Int
$chashWithSalt :: Int -> LinkedEditingRanges -> Int
Hashable)
  deriving forall ann. [LinkedEditingRanges] -> Doc ann
forall ann. LinkedEditingRanges -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [LinkedEditingRanges] -> Doc ann
$cprettyList :: forall ann. [LinkedEditingRanges] -> Doc ann
pretty :: forall ann. LinkedEditingRanges -> Doc ann
$cpretty :: forall ann. LinkedEditingRanges -> Doc ann
Pretty via (ViaJSON LinkedEditingRanges)

instance Aeson.ToJSON LinkedEditingRanges where
  toJSON :: LinkedEditingRanges -> Value
toJSON (LinkedEditingRanges [Range]
arg0 Maybe Text
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
"ranges" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= [Range]
arg0]
    ,String
"wordPattern" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg1]

instance Aeson.FromJSON LinkedEditingRanges where
  parseJSON :: Value -> Parser LinkedEditingRanges
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"LinkedEditingRanges" forall a b. (a -> b) -> a -> b
$ \Object
arg -> [Range] -> Maybe Text -> LinkedEditingRanges
LinkedEditingRanges forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"ranges" 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
"wordPattern"