How can asynchronous notifications be made to work reliably? api.txt recommends sending a series of nvim_buf_add_highlight
calls as notifications, but it’s not clear to me how to ensure that the highlights end up getting applied correctly if the buffer contents have changed by the time the notification arrives.
In general, I think I don’t really understand how asynchronous jobs that have visible effects don’t always race with other jobs or user actions.
(The other direction, where Neovim asynchronously notifies a plugin via rpcnotify
, makes sense to me).