Hi all,

Within the channel-based plugin govim
(https://github.com/govim/govim), the bulk of functionality is
triggered by user actions in Vim.

However, certain events are triggered entirely independently of Vim,
for example a list of diagnostics arriving from an LSP server, the LSP
server asking govim to show an error message. There are others.

When handling these non-Vim triggered events, any call from govim to
Vim is effectively racing (i.e. in a race condition) with whatever Vim
might be doing at the time. For example, we might happen to call from
govim -> Vim while Vim is in the middle of handling a listener_add
callback that itself calls ch_evalexpr which results in a call Vim ->
govim.

One thing we're not clear on is whether we should be "scheduling"
certain things in Vim. The channel docs
(https://github.com/vim/vim/blob/master/runtime/doc/channel.txt)
highlight that we should be checking what mode the user is in, but I
don't think this handles the case described.

What do I mean by scheduling? As I understand it, if when handling a
non-Vim triggered event we instead made a call into Vim that did
something like:

timer_start(0, { -> dostuff() })

then dostuff() will be "scheduled" by Vim "at a convenient time".

Would this approach work?

We're seeing some tests randomly failing and this "scheduling" problem
is our current hypothesis. But our understanding here is vague, so any
suggestions/guidance appreciated.

Thanks,


Paul

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CACoUkn6CeGdi-g4doVDzAk675zguVr-%3DoV_mkxawXt0E7xDA3A%40mail.gmail.com.

Raspunde prin e-mail lui