Paul Jolly
unread,Jan 17, 2020, 6:27:14 AM1/17/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Vim Dev Mailing List
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