{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.LSP.Types.Progress where
import Control.Monad (unless)
import qualified Data.Aeson as A
import Data.Aeson.TH
import Data.Maybe (catMaybes)
import Data.Text (Text)
import Language.LSP.Types.Utils
data ProgressToken
= ProgressNumericToken Int
| ProgressTextToken Text
deriving (Int -> ProgressToken -> ShowS
[ProgressToken] -> ShowS
ProgressToken -> String
(Int -> ProgressToken -> ShowS)
-> (ProgressToken -> String)
-> ([ProgressToken] -> ShowS)
-> Show ProgressToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressToken] -> ShowS
$cshowList :: [ProgressToken] -> ShowS
show :: ProgressToken -> String
$cshow :: ProgressToken -> String
showsPrec :: Int -> ProgressToken -> ShowS
$cshowsPrec :: Int -> ProgressToken -> ShowS
Show, ReadPrec [ProgressToken]
ReadPrec ProgressToken
Int -> ReadS ProgressToken
ReadS [ProgressToken]
(Int -> ReadS ProgressToken)
-> ReadS [ProgressToken]
-> ReadPrec ProgressToken
-> ReadPrec [ProgressToken]
-> Read ProgressToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProgressToken]
$creadListPrec :: ReadPrec [ProgressToken]
readPrec :: ReadPrec ProgressToken
$creadPrec :: ReadPrec ProgressToken
readList :: ReadS [ProgressToken]
$creadList :: ReadS [ProgressToken]
readsPrec :: Int -> ReadS ProgressToken
$creadsPrec :: Int -> ReadS ProgressToken
Read, ProgressToken -> ProgressToken -> Bool
(ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool) -> Eq ProgressToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressToken -> ProgressToken -> Bool
$c/= :: ProgressToken -> ProgressToken -> Bool
== :: ProgressToken -> ProgressToken -> Bool
$c== :: ProgressToken -> ProgressToken -> Bool
Eq, Eq ProgressToken
Eq ProgressToken
-> (ProgressToken -> ProgressToken -> Ordering)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> Bool)
-> (ProgressToken -> ProgressToken -> ProgressToken)
-> (ProgressToken -> ProgressToken -> ProgressToken)
-> Ord ProgressToken
ProgressToken -> ProgressToken -> Bool
ProgressToken -> ProgressToken -> Ordering
ProgressToken -> ProgressToken -> ProgressToken
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 :: ProgressToken -> ProgressToken -> ProgressToken
$cmin :: ProgressToken -> ProgressToken -> ProgressToken
max :: ProgressToken -> ProgressToken -> ProgressToken
$cmax :: ProgressToken -> ProgressToken -> ProgressToken
>= :: ProgressToken -> ProgressToken -> Bool
$c>= :: ProgressToken -> ProgressToken -> Bool
> :: ProgressToken -> ProgressToken -> Bool
$c> :: ProgressToken -> ProgressToken -> Bool
<= :: ProgressToken -> ProgressToken -> Bool
$c<= :: ProgressToken -> ProgressToken -> Bool
< :: ProgressToken -> ProgressToken -> Bool
$c< :: ProgressToken -> ProgressToken -> Bool
compare :: ProgressToken -> ProgressToken -> Ordering
$ccompare :: ProgressToken -> ProgressToken -> Ordering
$cp1Ord :: Eq ProgressToken
Ord)
deriveJSON lspOptionsUntagged ''ProgressToken
data ProgressParams t =
ProgressParams {
ProgressParams t -> ProgressToken
_token :: ProgressToken
, ProgressParams t -> t
_value :: t
} deriving (Int -> ProgressParams t -> ShowS
[ProgressParams t] -> ShowS
ProgressParams t -> String
(Int -> ProgressParams t -> ShowS)
-> (ProgressParams t -> String)
-> ([ProgressParams t] -> ShowS)
-> Show (ProgressParams t)
forall t. Show t => Int -> ProgressParams t -> ShowS
forall t. Show t => [ProgressParams t] -> ShowS
forall t. Show t => ProgressParams t -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressParams t] -> ShowS
$cshowList :: forall t. Show t => [ProgressParams t] -> ShowS
show :: ProgressParams t -> String
$cshow :: forall t. Show t => ProgressParams t -> String
showsPrec :: Int -> ProgressParams t -> ShowS
$cshowsPrec :: forall t. Show t => Int -> ProgressParams t -> ShowS
Show, ReadPrec [ProgressParams t]
ReadPrec (ProgressParams t)
Int -> ReadS (ProgressParams t)
ReadS [ProgressParams t]
(Int -> ReadS (ProgressParams t))
-> ReadS [ProgressParams t]
-> ReadPrec (ProgressParams t)
-> ReadPrec [ProgressParams t]
-> Read (ProgressParams t)
forall t. Read t => ReadPrec [ProgressParams t]
forall t. Read t => ReadPrec (ProgressParams t)
forall t. Read t => Int -> ReadS (ProgressParams t)
forall t. Read t => ReadS [ProgressParams t]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProgressParams t]
$creadListPrec :: forall t. Read t => ReadPrec [ProgressParams t]
readPrec :: ReadPrec (ProgressParams t)
$creadPrec :: forall t. Read t => ReadPrec (ProgressParams t)
readList :: ReadS [ProgressParams t]
$creadList :: forall t. Read t => ReadS [ProgressParams t]
readsPrec :: Int -> ReadS (ProgressParams t)
$creadsPrec :: forall t. Read t => Int -> ReadS (ProgressParams t)
Read, ProgressParams t -> ProgressParams t -> Bool
(ProgressParams t -> ProgressParams t -> Bool)
-> (ProgressParams t -> ProgressParams t -> Bool)
-> Eq (ProgressParams t)
forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressParams t -> ProgressParams t -> Bool
$c/= :: forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
== :: ProgressParams t -> ProgressParams t -> Bool
$c== :: forall t. Eq t => ProgressParams t -> ProgressParams t -> Bool
Eq, a -> ProgressParams b -> ProgressParams a
(a -> b) -> ProgressParams a -> ProgressParams b
(forall a b. (a -> b) -> ProgressParams a -> ProgressParams b)
-> (forall a b. a -> ProgressParams b -> ProgressParams a)
-> Functor ProgressParams
forall a b. a -> ProgressParams b -> ProgressParams a
forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> ProgressParams b -> ProgressParams a
$c<$ :: forall a b. a -> ProgressParams b -> ProgressParams a
fmap :: (a -> b) -> ProgressParams a -> ProgressParams b
$cfmap :: forall a b. (a -> b) -> ProgressParams a -> ProgressParams b
Functor)
deriveJSON lspOptions ''ProgressParams
data WorkDoneProgressBeginParams =
WorkDoneProgressBeginParams {
WorkDoneProgressBeginParams -> Text
_title :: Text
, WorkDoneProgressBeginParams -> Maybe Bool
_cancellable :: Maybe Bool
, WorkDoneProgressBeginParams -> Maybe Text
_message :: Maybe Text
, WorkDoneProgressBeginParams -> Maybe Double
_percentage :: Maybe Double
} deriving (Int -> WorkDoneProgressBeginParams -> ShowS
[WorkDoneProgressBeginParams] -> ShowS
WorkDoneProgressBeginParams -> String
(Int -> WorkDoneProgressBeginParams -> ShowS)
-> (WorkDoneProgressBeginParams -> String)
-> ([WorkDoneProgressBeginParams] -> ShowS)
-> Show WorkDoneProgressBeginParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressBeginParams] -> ShowS
$cshowList :: [WorkDoneProgressBeginParams] -> ShowS
show :: WorkDoneProgressBeginParams -> String
$cshow :: WorkDoneProgressBeginParams -> String
showsPrec :: Int -> WorkDoneProgressBeginParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressBeginParams -> ShowS
Show, ReadPrec [WorkDoneProgressBeginParams]
ReadPrec WorkDoneProgressBeginParams
Int -> ReadS WorkDoneProgressBeginParams
ReadS [WorkDoneProgressBeginParams]
(Int -> ReadS WorkDoneProgressBeginParams)
-> ReadS [WorkDoneProgressBeginParams]
-> ReadPrec WorkDoneProgressBeginParams
-> ReadPrec [WorkDoneProgressBeginParams]
-> Read WorkDoneProgressBeginParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressBeginParams]
$creadListPrec :: ReadPrec [WorkDoneProgressBeginParams]
readPrec :: ReadPrec WorkDoneProgressBeginParams
$creadPrec :: ReadPrec WorkDoneProgressBeginParams
readList :: ReadS [WorkDoneProgressBeginParams]
$creadList :: ReadS [WorkDoneProgressBeginParams]
readsPrec :: Int -> ReadS WorkDoneProgressBeginParams
$creadsPrec :: Int -> ReadS WorkDoneProgressBeginParams
Read, WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
(WorkDoneProgressBeginParams
-> WorkDoneProgressBeginParams -> Bool)
-> (WorkDoneProgressBeginParams
-> WorkDoneProgressBeginParams -> Bool)
-> Eq WorkDoneProgressBeginParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
$c/= :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
== :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
$c== :: WorkDoneProgressBeginParams -> WorkDoneProgressBeginParams -> Bool
Eq)
instance A.ToJSON WorkDoneProgressBeginParams where
toJSON :: WorkDoneProgressBeginParams -> Value
toJSON WorkDoneProgressBeginParams{Maybe Bool
Maybe Double
Maybe Text
Text
_percentage :: Maybe Double
_message :: Maybe Text
_cancellable :: Maybe Bool
_title :: Text
$sel:_percentage:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Maybe Double
$sel:_message:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Maybe Text
$sel:_cancellable:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Maybe Bool
$sel:_title:WorkDoneProgressBeginParams :: WorkDoneProgressBeginParams -> Text
..} =
[Pair] -> Value
A.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Text
"kind" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..= (Text
"begin" :: Text)
, Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Text
"title" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..= Text
_title
, (Text
"cancellable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
_cancellable
, (Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
, (Text
"percentage" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Double
_percentage
]
instance A.FromJSON WorkDoneProgressBeginParams where
parseJSON :: Value -> Parser WorkDoneProgressBeginParams
parseJSON = String
-> (Object -> Parser WorkDoneProgressBeginParams)
-> Value
-> Parser WorkDoneProgressBeginParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressBegin" ((Object -> Parser WorkDoneProgressBeginParams)
-> Value -> Parser WorkDoneProgressBeginParams)
-> (Object -> Parser WorkDoneProgressBeginParams)
-> Value
-> Parser WorkDoneProgressBeginParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Text
kind <- Object
o Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
A..: Text
"kind"
Bool -> Parser () -> Parser ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"begin" :: Text)) (Parser () -> Parser ()) -> Parser () -> Parser ()
forall a b. (a -> b) -> a -> b
$ String -> Parser ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ()) -> String -> Parser ()
forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"begin\" but got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
kind
Text
_title <- Object
o Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
A..: Text
"title"
Maybe Bool
_cancellable <- Object
o Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"cancellable"
Maybe Text
_message <- Object
o Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"message"
Maybe Double
_percentage <- Object
o Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"percentage"
WorkDoneProgressBeginParams -> Parser WorkDoneProgressBeginParams
forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressBeginParams :: Text
-> Maybe Bool
-> Maybe Text
-> Maybe Double
-> WorkDoneProgressBeginParams
WorkDoneProgressBeginParams{Maybe Bool
Maybe Double
Maybe Text
Text
_percentage :: Maybe Double
_message :: Maybe Text
_cancellable :: Maybe Bool
_title :: Text
$sel:_percentage:WorkDoneProgressBeginParams :: Maybe Double
$sel:_message:WorkDoneProgressBeginParams :: Maybe Text
$sel:_cancellable:WorkDoneProgressBeginParams :: Maybe Bool
$sel:_title:WorkDoneProgressBeginParams :: Text
..}
data WorkDoneProgressReportParams =
WorkDoneProgressReportParams {
WorkDoneProgressReportParams -> Maybe Bool
_cancellable :: Maybe Bool
, WorkDoneProgressReportParams -> Maybe Text
_message :: Maybe Text
, WorkDoneProgressReportParams -> Maybe Double
_percentage :: Maybe Double
} deriving (Int -> WorkDoneProgressReportParams -> ShowS
[WorkDoneProgressReportParams] -> ShowS
WorkDoneProgressReportParams -> String
(Int -> WorkDoneProgressReportParams -> ShowS)
-> (WorkDoneProgressReportParams -> String)
-> ([WorkDoneProgressReportParams] -> ShowS)
-> Show WorkDoneProgressReportParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressReportParams] -> ShowS
$cshowList :: [WorkDoneProgressReportParams] -> ShowS
show :: WorkDoneProgressReportParams -> String
$cshow :: WorkDoneProgressReportParams -> String
showsPrec :: Int -> WorkDoneProgressReportParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressReportParams -> ShowS
Show, ReadPrec [WorkDoneProgressReportParams]
ReadPrec WorkDoneProgressReportParams
Int -> ReadS WorkDoneProgressReportParams
ReadS [WorkDoneProgressReportParams]
(Int -> ReadS WorkDoneProgressReportParams)
-> ReadS [WorkDoneProgressReportParams]
-> ReadPrec WorkDoneProgressReportParams
-> ReadPrec [WorkDoneProgressReportParams]
-> Read WorkDoneProgressReportParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressReportParams]
$creadListPrec :: ReadPrec [WorkDoneProgressReportParams]
readPrec :: ReadPrec WorkDoneProgressReportParams
$creadPrec :: ReadPrec WorkDoneProgressReportParams
readList :: ReadS [WorkDoneProgressReportParams]
$creadList :: ReadS [WorkDoneProgressReportParams]
readsPrec :: Int -> ReadS WorkDoneProgressReportParams
$creadsPrec :: Int -> ReadS WorkDoneProgressReportParams
Read, WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
(WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool)
-> (WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool)
-> Eq WorkDoneProgressReportParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
$c/= :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
== :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
$c== :: WorkDoneProgressReportParams
-> WorkDoneProgressReportParams -> Bool
Eq)
instance A.ToJSON WorkDoneProgressReportParams where
toJSON :: WorkDoneProgressReportParams -> Value
toJSON WorkDoneProgressReportParams{Maybe Bool
Maybe Double
Maybe Text
_percentage :: Maybe Double
_message :: Maybe Text
_cancellable :: Maybe Bool
$sel:_percentage:WorkDoneProgressReportParams :: WorkDoneProgressReportParams -> Maybe Double
$sel:_message:WorkDoneProgressReportParams :: WorkDoneProgressReportParams -> Maybe Text
$sel:_cancellable:WorkDoneProgressReportParams :: WorkDoneProgressReportParams -> Maybe Bool
..} =
[Pair] -> Value
A.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Text
"kind" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..= (Text
"report" :: Text)
, (Text
"cancellable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
_cancellable
, (Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
, (Text
"percentage" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Double
_percentage
]
instance A.FromJSON WorkDoneProgressReportParams where
parseJSON :: Value -> Parser WorkDoneProgressReportParams
parseJSON = String
-> (Object -> Parser WorkDoneProgressReportParams)
-> Value
-> Parser WorkDoneProgressReportParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressReport" ((Object -> Parser WorkDoneProgressReportParams)
-> Value -> Parser WorkDoneProgressReportParams)
-> (Object -> Parser WorkDoneProgressReportParams)
-> Value
-> Parser WorkDoneProgressReportParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Text
kind <- Object
o Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
A..: Text
"kind"
Bool -> Parser () -> Parser ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"report" :: Text)) (Parser () -> Parser ()) -> Parser () -> Parser ()
forall a b. (a -> b) -> a -> b
$ String -> Parser ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ()) -> String -> Parser ()
forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"report\" but got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
kind
Maybe Bool
_cancellable <- Object
o Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"cancellable"
Maybe Text
_message <- Object
o Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"message"
Maybe Double
_percentage <- Object
o Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"percentage"
WorkDoneProgressReportParams -> Parser WorkDoneProgressReportParams
forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressReportParams :: Maybe Bool
-> Maybe Text -> Maybe Double -> WorkDoneProgressReportParams
WorkDoneProgressReportParams{Maybe Bool
Maybe Double
Maybe Text
_percentage :: Maybe Double
_message :: Maybe Text
_cancellable :: Maybe Bool
$sel:_percentage:WorkDoneProgressReportParams :: Maybe Double
$sel:_message:WorkDoneProgressReportParams :: Maybe Text
$sel:_cancellable:WorkDoneProgressReportParams :: Maybe Bool
..}
data WorkDoneProgressEndParams =
WorkDoneProgressEndParams {
WorkDoneProgressEndParams -> Maybe Text
_message :: Maybe Text
} deriving (Int -> WorkDoneProgressEndParams -> ShowS
[WorkDoneProgressEndParams] -> ShowS
WorkDoneProgressEndParams -> String
(Int -> WorkDoneProgressEndParams -> ShowS)
-> (WorkDoneProgressEndParams -> String)
-> ([WorkDoneProgressEndParams] -> ShowS)
-> Show WorkDoneProgressEndParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressEndParams] -> ShowS
$cshowList :: [WorkDoneProgressEndParams] -> ShowS
show :: WorkDoneProgressEndParams -> String
$cshow :: WorkDoneProgressEndParams -> String
showsPrec :: Int -> WorkDoneProgressEndParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressEndParams -> ShowS
Show, ReadPrec [WorkDoneProgressEndParams]
ReadPrec WorkDoneProgressEndParams
Int -> ReadS WorkDoneProgressEndParams
ReadS [WorkDoneProgressEndParams]
(Int -> ReadS WorkDoneProgressEndParams)
-> ReadS [WorkDoneProgressEndParams]
-> ReadPrec WorkDoneProgressEndParams
-> ReadPrec [WorkDoneProgressEndParams]
-> Read WorkDoneProgressEndParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressEndParams]
$creadListPrec :: ReadPrec [WorkDoneProgressEndParams]
readPrec :: ReadPrec WorkDoneProgressEndParams
$creadPrec :: ReadPrec WorkDoneProgressEndParams
readList :: ReadS [WorkDoneProgressEndParams]
$creadList :: ReadS [WorkDoneProgressEndParams]
readsPrec :: Int -> ReadS WorkDoneProgressEndParams
$creadsPrec :: Int -> ReadS WorkDoneProgressEndParams
Read, WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
(WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool)
-> (WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool)
-> Eq WorkDoneProgressEndParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
$c/= :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
== :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
$c== :: WorkDoneProgressEndParams -> WorkDoneProgressEndParams -> Bool
Eq)
instance A.ToJSON WorkDoneProgressEndParams where
toJSON :: WorkDoneProgressEndParams -> Value
toJSON WorkDoneProgressEndParams{Maybe Text
_message :: Maybe Text
$sel:_message:WorkDoneProgressEndParams :: WorkDoneProgressEndParams -> Maybe Text
..} =
[Pair] -> Value
A.object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$ [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Just (Pair -> Maybe Pair) -> Pair -> Maybe Pair
forall a b. (a -> b) -> a -> b
$ Text
"kind" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..= (Text
"end" :: Text)
, (Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
A..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Text
_message
]
instance A.FromJSON WorkDoneProgressEndParams where
parseJSON :: Value -> Parser WorkDoneProgressEndParams
parseJSON = String
-> (Object -> Parser WorkDoneProgressEndParams)
-> Value
-> Parser WorkDoneProgressEndParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"WorkDoneProgressEnd" ((Object -> Parser WorkDoneProgressEndParams)
-> Value -> Parser WorkDoneProgressEndParams)
-> (Object -> Parser WorkDoneProgressEndParams)
-> Value
-> Parser WorkDoneProgressEndParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Text
kind <- Object
o Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
A..: Text
"kind"
Bool -> Parser () -> Parser ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Text
kind Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"end" :: Text)) (Parser () -> Parser ()) -> Parser () -> Parser ()
forall a b. (a -> b) -> a -> b
$ String -> Parser ()
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser ()) -> String -> Parser ()
forall a b. (a -> b) -> a -> b
$ String
"Expected kind \"end\" but got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
kind
Maybe Text
_message <- Object
o Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
A..:? Text
"message"
WorkDoneProgressEndParams -> Parser WorkDoneProgressEndParams
forall (f :: * -> *) a. Applicative f => a -> f a
pure WorkDoneProgressEndParams :: Maybe Text -> WorkDoneProgressEndParams
WorkDoneProgressEndParams{Maybe Text
_message :: Maybe Text
$sel:_message:WorkDoneProgressEndParams :: Maybe Text
..}
data WorkDoneProgressCancelParams =
WorkDoneProgressCancelParams {
WorkDoneProgressCancelParams -> ProgressToken
_token :: ProgressToken
} deriving (Int -> WorkDoneProgressCancelParams -> ShowS
[WorkDoneProgressCancelParams] -> ShowS
WorkDoneProgressCancelParams -> String
(Int -> WorkDoneProgressCancelParams -> ShowS)
-> (WorkDoneProgressCancelParams -> String)
-> ([WorkDoneProgressCancelParams] -> ShowS)
-> Show WorkDoneProgressCancelParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressCancelParams] -> ShowS
$cshowList :: [WorkDoneProgressCancelParams] -> ShowS
show :: WorkDoneProgressCancelParams -> String
$cshow :: WorkDoneProgressCancelParams -> String
showsPrec :: Int -> WorkDoneProgressCancelParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressCancelParams -> ShowS
Show, ReadPrec [WorkDoneProgressCancelParams]
ReadPrec WorkDoneProgressCancelParams
Int -> ReadS WorkDoneProgressCancelParams
ReadS [WorkDoneProgressCancelParams]
(Int -> ReadS WorkDoneProgressCancelParams)
-> ReadS [WorkDoneProgressCancelParams]
-> ReadPrec WorkDoneProgressCancelParams
-> ReadPrec [WorkDoneProgressCancelParams]
-> Read WorkDoneProgressCancelParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressCancelParams]
$creadListPrec :: ReadPrec [WorkDoneProgressCancelParams]
readPrec :: ReadPrec WorkDoneProgressCancelParams
$creadPrec :: ReadPrec WorkDoneProgressCancelParams
readList :: ReadS [WorkDoneProgressCancelParams]
$creadList :: ReadS [WorkDoneProgressCancelParams]
readsPrec :: Int -> ReadS WorkDoneProgressCancelParams
$creadsPrec :: Int -> ReadS WorkDoneProgressCancelParams
Read, WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
(WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool)
-> (WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool)
-> Eq WorkDoneProgressCancelParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
$c/= :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
== :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
$c== :: WorkDoneProgressCancelParams
-> WorkDoneProgressCancelParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressCancelParams
data WorkDoneProgressCreateParams =
WorkDoneProgressCreateParams {
WorkDoneProgressCreateParams -> ProgressToken
_token :: ProgressToken
} deriving (Int -> WorkDoneProgressCreateParams -> ShowS
[WorkDoneProgressCreateParams] -> ShowS
WorkDoneProgressCreateParams -> String
(Int -> WorkDoneProgressCreateParams -> ShowS)
-> (WorkDoneProgressCreateParams -> String)
-> ([WorkDoneProgressCreateParams] -> ShowS)
-> Show WorkDoneProgressCreateParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressCreateParams] -> ShowS
$cshowList :: [WorkDoneProgressCreateParams] -> ShowS
show :: WorkDoneProgressCreateParams -> String
$cshow :: WorkDoneProgressCreateParams -> String
showsPrec :: Int -> WorkDoneProgressCreateParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressCreateParams -> ShowS
Show, ReadPrec [WorkDoneProgressCreateParams]
ReadPrec WorkDoneProgressCreateParams
Int -> ReadS WorkDoneProgressCreateParams
ReadS [WorkDoneProgressCreateParams]
(Int -> ReadS WorkDoneProgressCreateParams)
-> ReadS [WorkDoneProgressCreateParams]
-> ReadPrec WorkDoneProgressCreateParams
-> ReadPrec [WorkDoneProgressCreateParams]
-> Read WorkDoneProgressCreateParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressCreateParams]
$creadListPrec :: ReadPrec [WorkDoneProgressCreateParams]
readPrec :: ReadPrec WorkDoneProgressCreateParams
$creadPrec :: ReadPrec WorkDoneProgressCreateParams
readList :: ReadS [WorkDoneProgressCreateParams]
$creadList :: ReadS [WorkDoneProgressCreateParams]
readsPrec :: Int -> ReadS WorkDoneProgressCreateParams
$creadsPrec :: Int -> ReadS WorkDoneProgressCreateParams
Read, WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
(WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool)
-> (WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool)
-> Eq WorkDoneProgressCreateParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
$c/= :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
== :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
$c== :: WorkDoneProgressCreateParams
-> WorkDoneProgressCreateParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressCreateParams
data WorkDoneProgressOptions =
WorkDoneProgressOptions
{ WorkDoneProgressOptions -> Maybe Bool
_workDoneProgress :: Maybe Bool
}
deriving (ReadPrec [WorkDoneProgressOptions]
ReadPrec WorkDoneProgressOptions
Int -> ReadS WorkDoneProgressOptions
ReadS [WorkDoneProgressOptions]
(Int -> ReadS WorkDoneProgressOptions)
-> ReadS [WorkDoneProgressOptions]
-> ReadPrec WorkDoneProgressOptions
-> ReadPrec [WorkDoneProgressOptions]
-> Read WorkDoneProgressOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressOptions]
$creadListPrec :: ReadPrec [WorkDoneProgressOptions]
readPrec :: ReadPrec WorkDoneProgressOptions
$creadPrec :: ReadPrec WorkDoneProgressOptions
readList :: ReadS [WorkDoneProgressOptions]
$creadList :: ReadS [WorkDoneProgressOptions]
readsPrec :: Int -> ReadS WorkDoneProgressOptions
$creadsPrec :: Int -> ReadS WorkDoneProgressOptions
Read, Int -> WorkDoneProgressOptions -> ShowS
[WorkDoneProgressOptions] -> ShowS
WorkDoneProgressOptions -> String
(Int -> WorkDoneProgressOptions -> ShowS)
-> (WorkDoneProgressOptions -> String)
-> ([WorkDoneProgressOptions] -> ShowS)
-> Show WorkDoneProgressOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressOptions] -> ShowS
$cshowList :: [WorkDoneProgressOptions] -> ShowS
show :: WorkDoneProgressOptions -> String
$cshow :: WorkDoneProgressOptions -> String
showsPrec :: Int -> WorkDoneProgressOptions -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressOptions -> ShowS
Show, WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
(WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool)
-> (WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool)
-> Eq WorkDoneProgressOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
$c/= :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
== :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
$c== :: WorkDoneProgressOptions -> WorkDoneProgressOptions -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressOptions
data WorkDoneProgressParams =
WorkDoneProgressParams
{
WorkDoneProgressParams -> Maybe ProgressToken
_workDoneToken :: Maybe ProgressToken
} deriving (ReadPrec [WorkDoneProgressParams]
ReadPrec WorkDoneProgressParams
Int -> ReadS WorkDoneProgressParams
ReadS [WorkDoneProgressParams]
(Int -> ReadS WorkDoneProgressParams)
-> ReadS [WorkDoneProgressParams]
-> ReadPrec WorkDoneProgressParams
-> ReadPrec [WorkDoneProgressParams]
-> Read WorkDoneProgressParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkDoneProgressParams]
$creadListPrec :: ReadPrec [WorkDoneProgressParams]
readPrec :: ReadPrec WorkDoneProgressParams
$creadPrec :: ReadPrec WorkDoneProgressParams
readList :: ReadS [WorkDoneProgressParams]
$creadList :: ReadS [WorkDoneProgressParams]
readsPrec :: Int -> ReadS WorkDoneProgressParams
$creadsPrec :: Int -> ReadS WorkDoneProgressParams
Read,Int -> WorkDoneProgressParams -> ShowS
[WorkDoneProgressParams] -> ShowS
WorkDoneProgressParams -> String
(Int -> WorkDoneProgressParams -> ShowS)
-> (WorkDoneProgressParams -> String)
-> ([WorkDoneProgressParams] -> ShowS)
-> Show WorkDoneProgressParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressParams] -> ShowS
$cshowList :: [WorkDoneProgressParams] -> ShowS
show :: WorkDoneProgressParams -> String
$cshow :: WorkDoneProgressParams -> String
showsPrec :: Int -> WorkDoneProgressParams -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressParams -> ShowS
Show,WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
(WorkDoneProgressParams -> WorkDoneProgressParams -> Bool)
-> (WorkDoneProgressParams -> WorkDoneProgressParams -> Bool)
-> Eq WorkDoneProgressParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
$c/= :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
== :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
$c== :: WorkDoneProgressParams -> WorkDoneProgressParams -> Bool
Eq)
deriveJSON lspOptions ''WorkDoneProgressParams
data SomeProgressParams
= Begin WorkDoneProgressBeginParams
| Report WorkDoneProgressReportParams
| End WorkDoneProgressEndParams
deriving SomeProgressParams -> SomeProgressParams -> Bool
(SomeProgressParams -> SomeProgressParams -> Bool)
-> (SomeProgressParams -> SomeProgressParams -> Bool)
-> Eq SomeProgressParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SomeProgressParams -> SomeProgressParams -> Bool
$c/= :: SomeProgressParams -> SomeProgressParams -> Bool
== :: SomeProgressParams -> SomeProgressParams -> Bool
$c== :: SomeProgressParams -> SomeProgressParams -> Bool
Eq
deriveJSON lspOptionsUntagged ''SomeProgressParams
data PartialResultParams =
PartialResultParams
{
PartialResultParams -> Maybe ProgressToken
_partialResultToken :: Maybe ProgressToken
} deriving (ReadPrec [PartialResultParams]
ReadPrec PartialResultParams
Int -> ReadS PartialResultParams
ReadS [PartialResultParams]
(Int -> ReadS PartialResultParams)
-> ReadS [PartialResultParams]
-> ReadPrec PartialResultParams
-> ReadPrec [PartialResultParams]
-> Read PartialResultParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PartialResultParams]
$creadListPrec :: ReadPrec [PartialResultParams]
readPrec :: ReadPrec PartialResultParams
$creadPrec :: ReadPrec PartialResultParams
readList :: ReadS [PartialResultParams]
$creadList :: ReadS [PartialResultParams]
readsPrec :: Int -> ReadS PartialResultParams
$creadsPrec :: Int -> ReadS PartialResultParams
Read,Int -> PartialResultParams -> ShowS
[PartialResultParams] -> ShowS
PartialResultParams -> String
(Int -> PartialResultParams -> ShowS)
-> (PartialResultParams -> String)
-> ([PartialResultParams] -> ShowS)
-> Show PartialResultParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartialResultParams] -> ShowS
$cshowList :: [PartialResultParams] -> ShowS
show :: PartialResultParams -> String
$cshow :: PartialResultParams -> String
showsPrec :: Int -> PartialResultParams -> ShowS
$cshowsPrec :: Int -> PartialResultParams -> ShowS
Show,PartialResultParams -> PartialResultParams -> Bool
(PartialResultParams -> PartialResultParams -> Bool)
-> (PartialResultParams -> PartialResultParams -> Bool)
-> Eq PartialResultParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartialResultParams -> PartialResultParams -> Bool
$c/= :: PartialResultParams -> PartialResultParams -> Bool
== :: PartialResultParams -> PartialResultParams -> Bool
$c== :: PartialResultParams -> PartialResultParams -> Bool
Eq)
deriveJSON lspOptions ''PartialResultParams