Skip to content

publishDiagnostics messages don't include the document version #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yorickpeterse opened this issue Oct 20, 2021 · 3 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@yorickpeterse
Copy link

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
@sumneko sumneko added the enhancement New feature or request label Oct 21, 2021
@sumneko sumneko added this to the 2.5.0 milestone Oct 21, 2021
@sumneko sumneko closed this as completed in 86da132 Nov 3, 2021
@yorickpeterse
Copy link
Author

@sumneko Thanks! 🎉

@yorickpeterse
Copy link
Author

@sumneko It seems that with the 2.5.1 release this is no longer working, as diagnostics are not including the version anymore. For example:

{
  diagnostics = { {
      code = "lowercase-global",
      message = "Global variable in lowercase initial, Did you miss `local` or misspell it?",
      range = {
        end = {
          character = 32,
          line = 222
        },
        start = {
          character = 9,
          line = 222
        }
      },
      severity = 3,
      source = "Lua Diagnostics."
    } },
  uri = "file:///home/yorickpeterse/Projects/general/dotfiles/dotfiles/.config/nvim/lua/dotfiles/completion.lua"
}

@sumneko
Copy link
Collaborator

sumneko commented Dec 1, 2021

Please open a new issue, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants