Example #1
0
 def run(nvim: Nvim) -> None:
     fut = run_coroutine_threadsafe(co, loop)
     try:
         fut.result()
     except Exception as e:
         stack = format_exc()
         nvim.async_call(nvim.err_write, f"{stack}{e}{linesep}")
Example #2
0
def call(nvim: Nvim, fn: Callable[[], T]) -> Awaitable[T]:
    fut: Future = Future()

    def cont() -> None:
        try:
            ret = fn()
        except Exception as e:
            fut.set_exception(e)
        else:
            fut.set_result(ret)

    nvim.async_call(cont)
    return fut