{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
module Language.LSP.Types.FoldingRange where
import qualified Data.Aeson as A
import Data.Aeson.TH
import Data.Text (Text)
import Language.LSP.Types.Common
import Language.LSP.Types.Progress
import Language.LSP.Types.StaticRegistrationOptions
import Language.LSP.Types.TextDocument
import Language.LSP.Types.Utils
data FoldingRangeClientCapabilities =
FoldingRangeClientCapabilities
{
FoldingRangeClientCapabilities -> Maybe Bool
_dynamicRegistration :: Maybe Bool
, FoldingRangeClientCapabilities -> Maybe UInt
_rangeLimit :: Maybe UInt
, FoldingRangeClientCapabilities -> Maybe Bool
_lineFoldingOnly :: Maybe Bool
} deriving (Int -> FoldingRangeClientCapabilities -> ShowS
[FoldingRangeClientCapabilities] -> ShowS
FoldingRangeClientCapabilities -> String
(Int -> FoldingRangeClientCapabilities -> ShowS)
-> (FoldingRangeClientCapabilities -> String)
-> ([FoldingRangeClientCapabilities] -> ShowS)
-> Show FoldingRangeClientCapabilities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FoldingRangeClientCapabilities] -> ShowS
$cshowList :: [FoldingRangeClientCapabilities] -> ShowS
show :: FoldingRangeClientCapabilities -> String
$cshow :: FoldingRangeClientCapabilities -> String
showsPrec :: Int -> FoldingRangeClientCapabilities -> ShowS
$cshowsPrec :: Int -> FoldingRangeClientCapabilities -> ShowS
Show, ReadPrec [FoldingRangeClientCapabilities]
ReadPrec FoldingRangeClientCapabilities
Int -> ReadS FoldingRangeClientCapabilities
ReadS [FoldingRangeClientCapabilities]
(Int -> ReadS FoldingRangeClientCapabilities)
-> ReadS [FoldingRangeClientCapabilities]
-> ReadPrec FoldingRangeClientCapabilities
-> ReadPrec [FoldingRangeClientCapabilities]
-> Read FoldingRangeClientCapabilities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FoldingRangeClientCapabilities]
$creadListPrec :: ReadPrec [FoldingRangeClientCapabilities]
readPrec :: ReadPrec FoldingRangeClientCapabilities
$creadPrec :: ReadPrec FoldingRangeClientCapabilities
readList :: ReadS [FoldingRangeClientCapabilities]
$creadList :: ReadS [FoldingRangeClientCapabilities]
readsPrec :: Int -> ReadS FoldingRangeClientCapabilities
$creadsPrec :: Int -> ReadS FoldingRangeClientCapabilities
Read, FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool
(FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool)
-> (FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool)
-> Eq FoldingRangeClientCapabilities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool
$c/= :: FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool
== :: FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool
$c== :: FoldingRangeClientCapabilities
-> FoldingRangeClientCapabilities -> Bool
Eq)
deriveJSON lspOptions ''FoldingRangeClientCapabilities
makeExtendingDatatype "FoldingRangeOptions" [''WorkDoneProgressOptions] []
deriveJSON lspOptions ''FoldingRangeOptions
makeExtendingDatatype "FoldingRangeRegistrationOptions"
[ ''TextDocumentRegistrationOptions
, ''FoldingRangeOptions
, ''StaticRegistrationOptions
] []
deriveJSON lspOptions ''FoldingRangeRegistrationOptions
makeExtendingDatatype "FoldingRangeParams"
[ ''WorkDoneProgressParams
, ''PartialResultParams
]
[("_textDocument", [t| TextDocumentIdentifier |])]
deriveJSON lspOptions ''FoldingRangeParams
data FoldingRangeKind =
| FoldingRangeImports
| FoldingRangeRegion
| FoldingRangeUnknown Text
deriving (ReadPrec [FoldingRangeKind]
ReadPrec FoldingRangeKind
Int -> ReadS FoldingRangeKind
ReadS [FoldingRangeKind]
(Int -> ReadS FoldingRangeKind)
-> ReadS [FoldingRangeKind]
-> ReadPrec FoldingRangeKind
-> ReadPrec [FoldingRangeKind]
-> Read FoldingRangeKind
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FoldingRangeKind]
$creadListPrec :: ReadPrec [FoldingRangeKind]
readPrec :: ReadPrec FoldingRangeKind
$creadPrec :: ReadPrec FoldingRangeKind
readList :: ReadS [FoldingRangeKind]
$creadList :: ReadS [FoldingRangeKind]
readsPrec :: Int -> ReadS FoldingRangeKind
$creadsPrec :: Int -> ReadS FoldingRangeKind
Read, Int -> FoldingRangeKind -> ShowS
[FoldingRangeKind] -> ShowS
FoldingRangeKind -> String
(Int -> FoldingRangeKind -> ShowS)
-> (FoldingRangeKind -> String)
-> ([FoldingRangeKind] -> ShowS)
-> Show FoldingRangeKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FoldingRangeKind] -> ShowS
$cshowList :: [FoldingRangeKind] -> ShowS
show :: FoldingRangeKind -> String
$cshow :: FoldingRangeKind -> String
showsPrec :: Int -> FoldingRangeKind -> ShowS
$cshowsPrec :: Int -> FoldingRangeKind -> ShowS
Show, FoldingRangeKind -> FoldingRangeKind -> Bool
(FoldingRangeKind -> FoldingRangeKind -> Bool)
-> (FoldingRangeKind -> FoldingRangeKind -> Bool)
-> Eq FoldingRangeKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FoldingRangeKind -> FoldingRangeKind -> Bool
$c/= :: FoldingRangeKind -> FoldingRangeKind -> Bool
== :: FoldingRangeKind -> FoldingRangeKind -> Bool
$c== :: FoldingRangeKind -> FoldingRangeKind -> Bool
Eq)
instance A.ToJSON FoldingRangeKind where
toJSON :: FoldingRangeKind -> Value
toJSON FoldingRangeKind
FoldingRangeComment = Text -> Value
A.String Text
"comment"
toJSON FoldingRangeKind
FoldingRangeImports = Text -> Value
A.String Text
"imports"
toJSON FoldingRangeKind
FoldingRangeRegion = Text -> Value
A.String Text
"region"
toJSON (FoldingRangeUnknown Text
x) = Text -> Value
A.String Text
x
instance A.FromJSON FoldingRangeKind where
parseJSON :: Value -> Parser FoldingRangeKind
parseJSON (A.String Text
"comment") = FoldingRangeKind -> Parser FoldingRangeKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure FoldingRangeKind
FoldingRangeComment
parseJSON (A.String Text
"imports") = FoldingRangeKind -> Parser FoldingRangeKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure FoldingRangeKind
FoldingRangeImports
parseJSON (A.String Text
"region") = FoldingRangeKind -> Parser FoldingRangeKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure FoldingRangeKind
FoldingRangeRegion
parseJSON (A.String Text
x) = FoldingRangeKind -> Parser FoldingRangeKind
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text -> FoldingRangeKind
FoldingRangeUnknown Text
x)
parseJSON Value
_ = String -> Parser FoldingRangeKind
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"FoldingRangeKind"
data FoldingRange =
FoldingRange
{
FoldingRange -> UInt
_startLine :: UInt
, FoldingRange -> Maybe UInt
_startCharacter :: Maybe UInt
, FoldingRange -> UInt
_endLine :: UInt
, FoldingRange -> Maybe UInt
_endCharacter :: Maybe UInt
, FoldingRange -> Maybe FoldingRangeKind
_kind :: Maybe FoldingRangeKind
}
deriving (ReadPrec [FoldingRange]
ReadPrec FoldingRange
Int -> ReadS FoldingRange
ReadS [FoldingRange]
(Int -> ReadS FoldingRange)
-> ReadS [FoldingRange]
-> ReadPrec FoldingRange
-> ReadPrec [FoldingRange]
-> Read FoldingRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FoldingRange]
$creadListPrec :: ReadPrec [FoldingRange]
readPrec :: ReadPrec FoldingRange
$creadPrec :: ReadPrec FoldingRange
readList :: ReadS [FoldingRange]
$creadList :: ReadS [FoldingRange]
readsPrec :: Int -> ReadS FoldingRange
$creadsPrec :: Int -> ReadS FoldingRange
Read, Int -> FoldingRange -> ShowS
[FoldingRange] -> ShowS
FoldingRange -> String
(Int -> FoldingRange -> ShowS)
-> (FoldingRange -> String)
-> ([FoldingRange] -> ShowS)
-> Show FoldingRange
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
(FoldingRange -> FoldingRange -> Bool)
-> (FoldingRange -> FoldingRange -> Bool) -> Eq FoldingRange
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)
deriveJSON lspOptions ''FoldingRange