示例#1
0
文件: venv.py 项目: tek/chromatin.py
def plugin_venv(base_dir: Path, rplugin: Rplugin) -> Do:
    yield venv_existent(base_dir)(rplugin)
    venv_status = yield N.from_io(check_venv(base_dir, rplugin))
    yield (
        N.pure(venv_status.venv)
        if isinstance(venv_status, VenvPresent) else
        N.error(f'venv for {rplugin} did not appear')
    )
示例#2
0
def define_handlers(active_rplugin: ActiveRplugin) -> Do:
    channel = active_rplugin.channel
    cname = camelcaseify(active_rplugin.name)
    rpc_handlers_fun = f'{cname}RpcHandlers'
    result = yield N.call_once_defined(rpc_handlers_fun, timeout=3)
    handlers = (Lists.wrap(result).flat_map(RpcHandlerSpec.decode).map(
        lambda spec: ActiveRpcTrigger(spec=spec, channel=channel)))
    yield N.pure(handlers)
示例#3
0
文件: host.py 项目: tek/chromatin.py
def start_host(
    cmdline: str,
    debug: bool = False,
) -> Do:
    ribo_log.debug(f'starting host: {cmdline}; debug: {debug}')
    stderr_handler_name = yield define_rpc_stderr_handler(
        stderr_handler_prefix)
    channel = yield nvim_call_tpe(
        int, 'jobstart', cmdline, dict(rpc=True,
                                       on_stderr=stderr_handler_name))
    pid = yield nvim_call_tpe(int, 'jobpid', channel)
    ribo_log.debug(f'host running, channel {channel}, pid {pid}')
    yield N.pure((channel, pid))