Skip to content

publishDiagnostics messages don't include the document version #746

Closed
@yorickpeterse

Description

@yorickpeterse

Describe the bug

The publishDiagnostics messages don't contain the optional version field as outlined in the spec. This field is useful for checking if diagnostics are still relevant (= their version is the same as the document version). Sadly, it seems lua-language-server doesn't include this field.

Backstory: I'm writing a plugin for NeoVim to defer showing diagnostics until after a write. Since diagnostics may be received after a write (but belong to the document state from before the write), I check the version field to see if the diagnostics should be displayed immediately, or if they should be set aside until the next write.

For lua-language-server this isn't possible due to the version field being left out. This means that if you save a file super fast (or it takes lua-language-server longer to produce diagnostics) after making a change, not all diagnostics are displayed.

To Reproduce

  1. Produce diagnostics
  2. Note that the version field isn't included

Expected behavior

The version field is included, and points to the version of the document at the time the diagnostics were produced.

Environment (please complete the following information):

  • OS: Linux
  • Client: NeoVim
  • Version: 2.4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions