fix(lsp): revert buf_versions deprecation/replacement (#29217)

* Revert "fix(lsp): account for changedtick version gap on modified reset (#29170)"

This reverts commit 2e6d295f79.

* Revert "refactor(lsp): replace util.buf_versions with changedtick (#28943)"

This reverts commit 5c33815448.
This commit is contained in:
Mathias Fußenegger
2024-06-07 11:36:46 +02:00
committed by GitHub
parent 6c7677e5d2
commit 6e45cd7f00
10 changed files with 69 additions and 67 deletions

View File

@@ -484,6 +484,7 @@ local function text_document_did_save_handler(bufnr)
text = lsp._buf_get_full_text(bufnr),
},
})
util.buf_versions[bufnr] = 0
end
local save_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'save')
if save_capability then
@@ -519,6 +520,7 @@ local function buf_detach_client(bufnr, client)
end
client.attached_buffers[bufnr] = nil
util.buf_versions[bufnr] = nil
local namespace = lsp.diagnostic.get_namespace(client.id)
vim.diagnostic.reset(namespace, bufnr)
@@ -574,11 +576,12 @@ local function buf_attach(bufnr)
})
-- First time, so attach and set up stuff.
api.nvim_buf_attach(bufnr, false, {
on_lines = function(_, _, _, firstline, lastline, new_lastline)
on_lines = function(_, _, changedtick, firstline, lastline, new_lastline)
if #lsp.get_clients({ bufnr = bufnr }) == 0 then
-- detach if there are no clients
return #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0
end
util.buf_versions[bufnr] = changedtick
changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
end,