Copyright | (c) Sebastian Witte |
---|---|
License | Apache-2.0 |
Maintainer | woozletoff@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
- type FunctionMap = Map Text FunctionType
- data FunctionType
- data RPCConfig = RPCConfig {
- recipients :: TVar (Map Int64 (UTCTime, TMVar (Either Object Object)))
- functions :: TMVar FunctionMap
- newRPCConfig :: (Applicative io, MonadIO io) => io RPCConfig
- data SocketType
- createHandle :: (Functor io, MonadIO io) => IOMode -> SocketType -> io Handle
- cleanUpHandle :: MonadIO io => Handle -> Bool -> io ()
Documentation
type FunctionMap = Map Text FunctionType Source
A function map is a map containing the names of functions as keys and some context dependent value which contains all the necessary information to execute that function in the intended way.
This type is only used internally and handles two distinct cases. One case
is a direct function call, wich is simply a function that accepts a list of
Object
values and returns a result in the Neovim
context. The second
case is calling a function that has a persistent state. This is mediated to
a thread that reads from a TQueue
. (NB: persistent currently means, that
state is stored for as long as the plugin provider is running and not
restarted.)
data FunctionType Source
Things shared between the socket reader and the event handler.
RPCConfig | |
|
newRPCConfig :: (Applicative io, MonadIO io) => io RPCConfig Source
Create a new basic configuration containing a communication channel for remote procedure call events and an empty lookup table for functions to mediate.
data SocketType Source
Simple data type defining the kind of socket the socket reader should use.
Stdout Handle | Use the handle for receiving msgpack-rpc messages. This is suitable for an embedded neovim which is used in test cases. |
Environment | Read the connection information from the environment
variable |
UnixSocket FilePath | Use a unix socket. |
TCP Int String | Use an IP socket. First argument is the port and the second is the host name. |
createHandle :: (Functor io, MonadIO io) => IOMode -> SocketType -> io Handle Source
Create a Handle
from the given socket description.
The handle is not automatically closed.
cleanUpHandle :: MonadIO io => Handle -> Bool -> io () Source