Top

neovim.msgpack_rpc module

Msgpack-rpc subpackage.

This package implements a msgpack-rpc client. While it was designed for handling some Nvim particularities(server->client requests for example), the code here should work with other msgpack-rpc servers.

"""Msgpack-rpc subpackage.

This package implements a msgpack-rpc client. While it was designed for
handling some Nvim particularities(server->client requests for example), the
code here should work with other msgpack-rpc servers.
"""
from .async_session import AsyncSession
from .event_loop import EventLoop
from .msgpack_stream import MsgpackStream
from .session import ErrorResponse, Session


__all__ = ('tcp_session', 'socket_session', 'stdio_session', 'child_session',
           'ErrorResponse')


def session(transport_type='stdio', *args, **kwargs):
    loop = EventLoop(transport_type, *args, **kwargs)
    msgpack_stream = MsgpackStream(loop)
    async_session = AsyncSession(msgpack_stream)
    session = Session(async_session)
    return session


def tcp_session(address, port=7450):
    """Create a msgpack-rpc session from a tcp address/port."""
    return session('tcp', address, port)


def socket_session(path):
    """Create a msgpack-rpc session from a unix domain socket."""
    return session('socket', path)


def stdio_session():
    """Create a msgpack-rpc session from stdin/stdout."""
    return session('stdio')


def child_session(argv):
    """Create a msgpack-rpc session from a new Nvim instance."""
    return session('child', argv)

Functions

def child_session(

argv)

Create a msgpack-rpc session from a new Nvim instance.

def child_session(argv):
    """Create a msgpack-rpc session from a new Nvim instance."""
    return session('child', argv)

def socket_session(

path)

Create a msgpack-rpc session from a unix domain socket.

def socket_session(path):
    """Create a msgpack-rpc session from a unix domain socket."""
    return session('socket', path)

def stdio_session(

)

Create a msgpack-rpc session from stdin/stdout.

def stdio_session():
    """Create a msgpack-rpc session from stdin/stdout."""
    return session('stdio')

def tcp_session(

address, port=7450)

Create a msgpack-rpc session from a tcp address/port.

def tcp_session(address, port=7450):
    """Create a msgpack-rpc session from a tcp address/port."""
    return session('tcp', address, port)

Classes

class ErrorResponse

Raise this in a request handler to respond with a given error message.

Unlike when other exceptions are caught, this gives full control off the error response sent. When "ErrorResponse(msg)" is caught "msg" will be sent verbatim as the error response.No traceback will be appended.

class ErrorResponse(BaseException):

    """Raise this in a request handler to respond with a given error message.

    Unlike when other exceptions are caught, this gives full control off the
    error response sent. When "ErrorResponse(msg)" is caught "msg" will be
    sent verbatim as the error response.No traceback will be appended.
    """

    pass

Ancestors (in MRO)

Class variables

var args

Sub-modules

neovim.msgpack_rpc.async_session

Asynchronous msgpack-rpc handling in the event loop pipeline.

neovim.msgpack_rpc.event_loop

Event loop abstraction subpackage.

Tries to use pyuv as a backend, falling back to the asyncio implementation.

neovim.msgpack_rpc.msgpack_stream

Msgpack handling in the event loop pipeline.

neovim.msgpack_rpc.session

Synchronous msgpack-rpc session layer.