{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
module Language.LSP.Types.Window where
import qualified Data.Aeson as A
import Data.Aeson.TH
import Data.Text (Text)
import Language.LSP.Types.Utils
import Language.LSP.Types.Uri
import Language.LSP.Types.Location
data MessageType = MtError
| MtWarning
| MtInfo
| MtLog
deriving (MessageType -> MessageType -> Bool
(MessageType -> MessageType -> Bool)
-> (MessageType -> MessageType -> Bool) -> Eq MessageType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MessageType -> MessageType -> Bool
== :: MessageType -> MessageType -> Bool
$c/= :: MessageType -> MessageType -> Bool
/= :: MessageType -> MessageType -> Bool
Eq,Eq MessageType
Eq MessageType =>
(MessageType -> MessageType -> Ordering)
-> (MessageType -> MessageType -> Bool)
-> (MessageType -> MessageType -> Bool)
-> (MessageType -> MessageType -> Bool)
-> (MessageType -> MessageType -> Bool)
-> (MessageType -> MessageType -> MessageType)
-> (MessageType -> MessageType -> MessageType)
-> Ord MessageType
MessageType -> MessageType -> Bool
MessageType -> MessageType -> Ordering
MessageType -> MessageType -> MessageType
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
$ccompare :: MessageType -> MessageType -> Ordering
compare :: MessageType -> MessageType -> Ordering
$c< :: MessageType -> MessageType -> Bool
< :: MessageType -> MessageType -> Bool
$c<= :: MessageType -> MessageType -> Bool
<= :: MessageType -> MessageType -> Bool
$c> :: MessageType -> MessageType -> Bool
> :: MessageType -> MessageType -> Bool
$c>= :: MessageType -> MessageType -> Bool
>= :: MessageType -> MessageType -> Bool
$cmax :: MessageType -> MessageType -> MessageType
max :: MessageType -> MessageType -> MessageType
$cmin :: MessageType -> MessageType -> MessageType
min :: MessageType -> MessageType -> MessageType
Ord,Int -> MessageType -> ShowS
[MessageType] -> ShowS
MessageType -> String
(Int -> MessageType -> ShowS)
-> (MessageType -> String)
-> ([MessageType] -> ShowS)
-> Show MessageType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MessageType -> ShowS
showsPrec :: Int -> MessageType -> ShowS
$cshow :: MessageType -> String
show :: MessageType -> String
$cshowList :: [MessageType] -> ShowS
showList :: [MessageType] -> ShowS
Show,ReadPrec [MessageType]
ReadPrec MessageType
Int -> ReadS MessageType
ReadS [MessageType]
(Int -> ReadS MessageType)
-> ReadS [MessageType]
-> ReadPrec MessageType
-> ReadPrec [MessageType]
-> Read MessageType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS MessageType
readsPrec :: Int -> ReadS MessageType
$creadList :: ReadS [MessageType]
readList :: ReadS [MessageType]
$creadPrec :: ReadPrec MessageType
readPrec :: ReadPrec MessageType
$creadListPrec :: ReadPrec [MessageType]
readListPrec :: ReadPrec [MessageType]
Read,Int -> MessageType
MessageType -> Int
MessageType -> [MessageType]
MessageType -> MessageType
MessageType -> MessageType -> [MessageType]
MessageType -> MessageType -> MessageType -> [MessageType]
(MessageType -> MessageType)
-> (MessageType -> MessageType)
-> (Int -> MessageType)
-> (MessageType -> Int)
-> (MessageType -> [MessageType])
-> (MessageType -> MessageType -> [MessageType])
-> (MessageType -> MessageType -> [MessageType])
-> (MessageType -> MessageType -> MessageType -> [MessageType])
-> Enum MessageType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: MessageType -> MessageType
succ :: MessageType -> MessageType
$cpred :: MessageType -> MessageType
pred :: MessageType -> MessageType
$ctoEnum :: Int -> MessageType
toEnum :: Int -> MessageType
$cfromEnum :: MessageType -> Int
fromEnum :: MessageType -> Int
$cenumFrom :: MessageType -> [MessageType]
enumFrom :: MessageType -> [MessageType]
$cenumFromThen :: MessageType -> MessageType -> [MessageType]
enumFromThen :: MessageType -> MessageType -> [MessageType]
$cenumFromTo :: MessageType -> MessageType -> [MessageType]
enumFromTo :: MessageType -> MessageType -> [MessageType]
$cenumFromThenTo :: MessageType -> MessageType -> MessageType -> [MessageType]
enumFromThenTo :: MessageType -> MessageType -> MessageType -> [MessageType]
Enum)
instance A.ToJSON MessageType where
toJSON :: MessageType -> Value
toJSON MessageType
MtError = Scientific -> Value
A.Number Scientific
1
toJSON MessageType
MtWarning = Scientific -> Value
A.Number Scientific
2
toJSON MessageType
MtInfo = Scientific -> Value
A.Number Scientific
3
toJSON MessageType
MtLog = Scientific -> Value
A.Number Scientific
4
instance A.FromJSON MessageType where
parseJSON :: Value -> Parser MessageType
parseJSON (A.Number Scientific
1) = MessageType -> Parser MessageType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MessageType
MtError
parseJSON (A.Number Scientific
2) = MessageType -> Parser MessageType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MessageType
MtWarning
parseJSON (A.Number Scientific
3) = MessageType -> Parser MessageType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MessageType
MtInfo
parseJSON (A.Number Scientific
4) = MessageType -> Parser MessageType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MessageType
MtLog
parseJSON Value
_ = String -> Parser MessageType
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"MessageType"
data ShowMessageParams =
ShowMessageParams {
ShowMessageParams -> MessageType
_xtype :: MessageType
, ShowMessageParams -> Text
_message :: Text
} deriving (Int -> ShowMessageParams -> ShowS
[ShowMessageParams] -> ShowS
ShowMessageParams -> String
(Int -> ShowMessageParams -> ShowS)
-> (ShowMessageParams -> String)
-> ([ShowMessageParams] -> ShowS)
-> Show ShowMessageParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShowMessageParams -> ShowS
showsPrec :: Int -> ShowMessageParams -> ShowS
$cshow :: ShowMessageParams -> String
show :: ShowMessageParams -> String
$cshowList :: [ShowMessageParams] -> ShowS
showList :: [ShowMessageParams] -> ShowS
Show, ReadPrec [ShowMessageParams]
ReadPrec ShowMessageParams
Int -> ReadS ShowMessageParams
ReadS [ShowMessageParams]
(Int -> ReadS ShowMessageParams)
-> ReadS [ShowMessageParams]
-> ReadPrec ShowMessageParams
-> ReadPrec [ShowMessageParams]
-> Read ShowMessageParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ShowMessageParams
readsPrec :: Int -> ReadS ShowMessageParams
$creadList :: ReadS [ShowMessageParams]
readList :: ReadS [ShowMessageParams]
$creadPrec :: ReadPrec ShowMessageParams
readPrec :: ReadPrec ShowMessageParams
$creadListPrec :: ReadPrec [ShowMessageParams]
readListPrec :: ReadPrec [ShowMessageParams]
Read, ShowMessageParams -> ShowMessageParams -> Bool
(ShowMessageParams -> ShowMessageParams -> Bool)
-> (ShowMessageParams -> ShowMessageParams -> Bool)
-> Eq ShowMessageParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShowMessageParams -> ShowMessageParams -> Bool
== :: ShowMessageParams -> ShowMessageParams -> Bool
$c/= :: ShowMessageParams -> ShowMessageParams -> Bool
/= :: ShowMessageParams -> ShowMessageParams -> Bool
Eq)
deriveJSON lspOptions ''ShowMessageParams
data MessageActionItem =
MessageActionItem
{ MessageActionItem -> Text
_title :: Text
} deriving (Int -> MessageActionItem -> ShowS
[MessageActionItem] -> ShowS
MessageActionItem -> String
(Int -> MessageActionItem -> ShowS)
-> (MessageActionItem -> String)
-> ([MessageActionItem] -> ShowS)
-> Show MessageActionItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MessageActionItem -> ShowS
showsPrec :: Int -> MessageActionItem -> ShowS
$cshow :: MessageActionItem -> String
show :: MessageActionItem -> String
$cshowList :: [MessageActionItem] -> ShowS
showList :: [MessageActionItem] -> ShowS
Show,ReadPrec [MessageActionItem]
ReadPrec MessageActionItem
Int -> ReadS MessageActionItem
ReadS [MessageActionItem]
(Int -> ReadS MessageActionItem)
-> ReadS [MessageActionItem]
-> ReadPrec MessageActionItem
-> ReadPrec [MessageActionItem]
-> Read MessageActionItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS MessageActionItem
readsPrec :: Int -> ReadS MessageActionItem
$creadList :: ReadS [MessageActionItem]
readList :: ReadS [MessageActionItem]
$creadPrec :: ReadPrec MessageActionItem
readPrec :: ReadPrec MessageActionItem
$creadListPrec :: ReadPrec [MessageActionItem]
readListPrec :: ReadPrec [MessageActionItem]
Read,MessageActionItem -> MessageActionItem -> Bool
(MessageActionItem -> MessageActionItem -> Bool)
-> (MessageActionItem -> MessageActionItem -> Bool)
-> Eq MessageActionItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MessageActionItem -> MessageActionItem -> Bool
== :: MessageActionItem -> MessageActionItem -> Bool
$c/= :: MessageActionItem -> MessageActionItem -> Bool
/= :: MessageActionItem -> MessageActionItem -> Bool
Eq)
deriveJSON lspOptions ''MessageActionItem
data ShowMessageRequestParams =
ShowMessageRequestParams
{ ShowMessageRequestParams -> MessageType
_xtype :: MessageType
, ShowMessageRequestParams -> Text
_message :: Text
, ShowMessageRequestParams -> Maybe [MessageActionItem]
_actions :: Maybe [MessageActionItem]
} deriving (Int -> ShowMessageRequestParams -> ShowS
[ShowMessageRequestParams] -> ShowS
ShowMessageRequestParams -> String
(Int -> ShowMessageRequestParams -> ShowS)
-> (ShowMessageRequestParams -> String)
-> ([ShowMessageRequestParams] -> ShowS)
-> Show ShowMessageRequestParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShowMessageRequestParams -> ShowS
showsPrec :: Int -> ShowMessageRequestParams -> ShowS
$cshow :: ShowMessageRequestParams -> String
show :: ShowMessageRequestParams -> String
$cshowList :: [ShowMessageRequestParams] -> ShowS
showList :: [ShowMessageRequestParams] -> ShowS
Show,ReadPrec [ShowMessageRequestParams]
ReadPrec ShowMessageRequestParams
Int -> ReadS ShowMessageRequestParams
ReadS [ShowMessageRequestParams]
(Int -> ReadS ShowMessageRequestParams)
-> ReadS [ShowMessageRequestParams]
-> ReadPrec ShowMessageRequestParams
-> ReadPrec [ShowMessageRequestParams]
-> Read ShowMessageRequestParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ShowMessageRequestParams
readsPrec :: Int -> ReadS ShowMessageRequestParams
$creadList :: ReadS [ShowMessageRequestParams]
readList :: ReadS [ShowMessageRequestParams]
$creadPrec :: ReadPrec ShowMessageRequestParams
readPrec :: ReadPrec ShowMessageRequestParams
$creadListPrec :: ReadPrec [ShowMessageRequestParams]
readListPrec :: ReadPrec [ShowMessageRequestParams]
Read,ShowMessageRequestParams -> ShowMessageRequestParams -> Bool
(ShowMessageRequestParams -> ShowMessageRequestParams -> Bool)
-> (ShowMessageRequestParams -> ShowMessageRequestParams -> Bool)
-> Eq ShowMessageRequestParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShowMessageRequestParams -> ShowMessageRequestParams -> Bool
== :: ShowMessageRequestParams -> ShowMessageRequestParams -> Bool
$c/= :: ShowMessageRequestParams -> ShowMessageRequestParams -> Bool
/= :: ShowMessageRequestParams -> ShowMessageRequestParams -> Bool
Eq)
deriveJSON lspOptions ''ShowMessageRequestParams
data ShowDocumentParams =
ShowDocumentParams {
ShowDocumentParams -> Uri
_uri :: Uri
, ShowDocumentParams -> Maybe Bool
_external :: Maybe Bool
, ShowDocumentParams -> Maybe Bool
_takeFocus :: Maybe Bool
, ShowDocumentParams -> Maybe Range
_selection :: Maybe Range
} deriving (Int -> ShowDocumentParams -> ShowS
[ShowDocumentParams] -> ShowS
ShowDocumentParams -> String
(Int -> ShowDocumentParams -> ShowS)
-> (ShowDocumentParams -> String)
-> ([ShowDocumentParams] -> ShowS)
-> Show ShowDocumentParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShowDocumentParams -> ShowS
showsPrec :: Int -> ShowDocumentParams -> ShowS
$cshow :: ShowDocumentParams -> String
show :: ShowDocumentParams -> String
$cshowList :: [ShowDocumentParams] -> ShowS
showList :: [ShowDocumentParams] -> ShowS
Show, ReadPrec [ShowDocumentParams]
ReadPrec ShowDocumentParams
Int -> ReadS ShowDocumentParams
ReadS [ShowDocumentParams]
(Int -> ReadS ShowDocumentParams)
-> ReadS [ShowDocumentParams]
-> ReadPrec ShowDocumentParams
-> ReadPrec [ShowDocumentParams]
-> Read ShowDocumentParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ShowDocumentParams
readsPrec :: Int -> ReadS ShowDocumentParams
$creadList :: ReadS [ShowDocumentParams]
readList :: ReadS [ShowDocumentParams]
$creadPrec :: ReadPrec ShowDocumentParams
readPrec :: ReadPrec ShowDocumentParams
$creadListPrec :: ReadPrec [ShowDocumentParams]
readListPrec :: ReadPrec [ShowDocumentParams]
Read, ShowDocumentParams -> ShowDocumentParams -> Bool
(ShowDocumentParams -> ShowDocumentParams -> Bool)
-> (ShowDocumentParams -> ShowDocumentParams -> Bool)
-> Eq ShowDocumentParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShowDocumentParams -> ShowDocumentParams -> Bool
== :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c/= :: ShowDocumentParams -> ShowDocumentParams -> Bool
/= :: ShowDocumentParams -> ShowDocumentParams -> Bool
Eq)
deriveJSON lspOptions ''ShowDocumentParams
data ShowDocumentResult =
ShowDocumentResult {
ShowDocumentResult -> Bool
_success :: Bool
} deriving (Int -> ShowDocumentResult -> ShowS
[ShowDocumentResult] -> ShowS
ShowDocumentResult -> String
(Int -> ShowDocumentResult -> ShowS)
-> (ShowDocumentResult -> String)
-> ([ShowDocumentResult] -> ShowS)
-> Show ShowDocumentResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShowDocumentResult -> ShowS
showsPrec :: Int -> ShowDocumentResult -> ShowS
$cshow :: ShowDocumentResult -> String
show :: ShowDocumentResult -> String
$cshowList :: [ShowDocumentResult] -> ShowS
showList :: [ShowDocumentResult] -> ShowS
Show, ReadPrec [ShowDocumentResult]
ReadPrec ShowDocumentResult
Int -> ReadS ShowDocumentResult
ReadS [ShowDocumentResult]
(Int -> ReadS ShowDocumentResult)
-> ReadS [ShowDocumentResult]
-> ReadPrec ShowDocumentResult
-> ReadPrec [ShowDocumentResult]
-> Read ShowDocumentResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ShowDocumentResult
readsPrec :: Int -> ReadS ShowDocumentResult
$creadList :: ReadS [ShowDocumentResult]
readList :: ReadS [ShowDocumentResult]
$creadPrec :: ReadPrec ShowDocumentResult
readPrec :: ReadPrec ShowDocumentResult
$creadListPrec :: ReadPrec [ShowDocumentResult]
readListPrec :: ReadPrec [ShowDocumentResult]
Read, ShowDocumentResult -> ShowDocumentResult -> Bool
(ShowDocumentResult -> ShowDocumentResult -> Bool)
-> (ShowDocumentResult -> ShowDocumentResult -> Bool)
-> Eq ShowDocumentResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShowDocumentResult -> ShowDocumentResult -> Bool
== :: ShowDocumentResult -> ShowDocumentResult -> Bool
$c/= :: ShowDocumentResult -> ShowDocumentResult -> Bool
/= :: ShowDocumentResult -> ShowDocumentResult -> Bool
Eq)
deriveJSON lspOptions ''ShowDocumentResult
data LogMessageParams =
LogMessageParams {
LogMessageParams -> MessageType
_xtype :: MessageType
, LogMessageParams -> Text
_message :: Text
} deriving (Int -> LogMessageParams -> ShowS
[LogMessageParams] -> ShowS
LogMessageParams -> String
(Int -> LogMessageParams -> ShowS)
-> (LogMessageParams -> String)
-> ([LogMessageParams] -> ShowS)
-> Show LogMessageParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LogMessageParams -> ShowS
showsPrec :: Int -> LogMessageParams -> ShowS
$cshow :: LogMessageParams -> String
show :: LogMessageParams -> String
$cshowList :: [LogMessageParams] -> ShowS
showList :: [LogMessageParams] -> ShowS
Show, ReadPrec [LogMessageParams]
ReadPrec LogMessageParams
Int -> ReadS LogMessageParams
ReadS [LogMessageParams]
(Int -> ReadS LogMessageParams)
-> ReadS [LogMessageParams]
-> ReadPrec LogMessageParams
-> ReadPrec [LogMessageParams]
-> Read LogMessageParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS LogMessageParams
readsPrec :: Int -> ReadS LogMessageParams
$creadList :: ReadS [LogMessageParams]
readList :: ReadS [LogMessageParams]
$creadPrec :: ReadPrec LogMessageParams
readPrec :: ReadPrec LogMessageParams
$creadListPrec :: ReadPrec [LogMessageParams]
readListPrec :: ReadPrec [LogMessageParams]
Read, LogMessageParams -> LogMessageParams -> Bool
(LogMessageParams -> LogMessageParams -> Bool)
-> (LogMessageParams -> LogMessageParams -> Bool)
-> Eq LogMessageParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LogMessageParams -> LogMessageParams -> Bool
== :: LogMessageParams -> LogMessageParams -> Bool
$c/= :: LogMessageParams -> LogMessageParams -> Bool
/= :: LogMessageParams -> LogMessageParams -> Bool
Eq)
deriveJSON lspOptions ''LogMessageParams