Revert "feat(lsp): support version in textDocument/publishDiagnostics #36754" (#36865)

This reverts commit 03d6cf7aae.

See https://github.com/neovim/neovim/pull/36754#issuecomment-3626115697
The change was supposed to avoid showing stale diagnostics but had the
opposite effect.
This commit is contained in:
Mathias Fußenegger
2025-12-09 13:29:21 +01:00
committed by GitHub
parent 23f4fab0bd
commit c5d4050586
4 changed files with 2 additions and 44 deletions

View File

@@ -148,40 +148,6 @@ describe('vim.lsp.diagnostic', function()
)
end)
it('ignores outdated diagnostics', function()
local result = exec_lua(function()
vim.lsp.diagnostic.on_publish_diagnostics(nil, {
uri = fake_uri,
version = vim.lsp.util.buf_versions[diagnostic_bufnr] - 1,
diagnostics = {
_G.make_error('Error', 0, 0, 1, 0),
},
}, { client_id = client_id })
local diags = vim.diagnostic.get(diagnostic_bufnr)
return diags
end)
-- Ignored: outdated version.
eq(0, #result)
result = exec_lua(function()
vim.lsp.diagnostic.on_publish_diagnostics(nil, {
uri = fake_uri,
version = vim.lsp.util.buf_versions[diagnostic_bufnr],
diagnostics = {
_G.make_error('Error', 0, 0, 1, 0),
},
}, { client_id = client_id })
local diags = vim.diagnostic.get(diagnostic_bufnr)
return diags
end)
-- Applied: up-to-date version.
eq(1, #result)
end)
it('does not create buffer on empty diagnostics', function()
-- No buffer is created without diagnostics
eq(