Hi all,

In govim we get diagnostics about code that is being edited in Vim via
async notifications from gopls, the Go LSP server implementation. We
then place signs and add text properties as a function of those
diagnostics to highlight issues to the user.

Diagnostics have a versioned reference to the file to which they correspond.

As an efficiency measure, gopls only resends diagnostics for a file if
the resulting diagnostics change. e.g. making a change to a file at
version v (resulting in v') will only trigger new diagnostics to be
sent for that file (at version v') if they (the diagnostics) are
different to the diagnostics for version v. The justification for this
approach is performance and based on evidence thus far it's a sound
decision.

However this has the implication that govim cannot use its state of
the file's version to only apply diagnostics (place signs, add text
properties) for that file when it matches the diagnostic's versioned
reference. Because the diagnostics for v' might well still be current
for file version v''.

Hence we need to place signs/add text properties in such a way that we
know they might fail (because it might be the case that we have simply
not yet received the latest "correct" diagnostics for that file -
diagnostics are, after all, async).

One approach we are therefore considering is to place signs/add text
properties within a try/catch block, and simply swallow any errors
safe in the knowledge that "things will right themselves soon").

Does anyone foresee any problems with this approach?

Is there anything else we should be considering here?

Many 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/CACoUkn5qAx3NCREd5%3DywqZ0Dkg65-QxHGZcfNVPw6Ea5u5fUeA%40mail.gmail.com.

Raspunde prin e-mail lui