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

{-|
Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
than the number of lines in the document. Clients are free to ignore invalid ranges.
-}
data FoldingRange = FoldingRange 
  { {-|
  The zero-based start line of the range to fold. The folded area starts after the line's last character.
  To be valid, the end must be zero or larger and smaller than the number of lines in the document.
  -}
  FoldingRange -> UInt
_startLine :: Language.LSP.Protocol.Types.Common.UInt
  , {-|
  The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
  -}
  FoldingRange -> Maybe UInt
_startCharacter :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
  , {-|
  The zero-based end line of the range to fold. The folded area ends with the line's last character.
  To be valid, the end must be zero or larger and smaller than the number of lines in the document.
  -}
  FoldingRange -> UInt
_endLine :: Language.LSP.Protocol.Types.Common.UInt
  , {-|
  The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
  -}
  FoldingRange -> Maybe UInt
_endCharacter :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
  , {-|
  Describes the kind of the folding range such as `comment' or 'region'. The kind
  is used to categorize folding ranges and used by commands like 'Fold all comments'.
  See `FoldingRangeKind` for an enumeration of standardized kinds.
  -}
  FoldingRange -> Maybe FoldingRangeKind
_kind :: (Maybe Language.LSP.Protocol.Internal.Types.FoldingRangeKind.FoldingRangeKind)
  , {-|
  The text that the client should show when the specified range is
  collapsed. If not defined or not supported by the client, a default
  will be chosen by the client.

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

instance Aeson.ToJSON FoldingRange where
  toJSON :: FoldingRange -> Value
toJSON (FoldingRange UInt
arg0 Maybe UInt
arg1 UInt
arg2 Maybe UInt
arg3 Maybe FoldingRangeKind
arg4 Maybe Text
arg5) = [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
"startLine" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg0]
    ,String
"startCharacter" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe UInt
arg1
    ,[Key
"endLine" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg2]
    ,String
"endCharacter" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe UInt
arg3
    ,String
"kind" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe FoldingRangeKind
arg4
    ,String
"collapsedText" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg5]

instance Aeson.FromJSON FoldingRange where
  parseJSON :: Value -> Parser FoldingRange
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"FoldingRange" forall a b. (a -> b) -> a -> b
$ \Object
arg -> UInt
-> Maybe UInt
-> UInt
-> Maybe UInt
-> Maybe FoldingRangeKind
-> Maybe Text
-> FoldingRange
FoldingRange forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"startLine" 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
"startCharacter" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"endLine" 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
"endCharacter" 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
"kind" 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
"collapsedText"