Skip to content

Using extempore.vim on NeoVim errors due to requests from non-main threads #3

@yorickpeterse

Description

@yorickpeterse

On recent versions of NeoVim, requests can not be made from the non main-thread. This results in errors produced by the output_poller method. This is because it uses print() from a different thread. This can be worked around using the following diff:

diff --git a/python/extempore3.py b/python/extempore3.py
index f8e9236..fad026f 100644
--- a/python/extempore3.py
+++ b/python/extempore3.py
@@ -14,7 +14,7 @@ def output_poller():
         return
     output = read_output()
     if output != "":
-        print(output)
+        vim.async_call(print, output)
     threading.Timer(0.3, output_poller).start()

This works for me, but it might not work for Vim installations where async_call (https://pynvim.readthedocs.io/en/latest/usage/python-plugin-api.html#async-calls) is not available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions