mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 20:38:18 +00:00
Use buffer version instead of changedtick for edits
This commit is contained in:

committed by
Jesse Bakker

parent
ff1730373c
commit
1fe01b36de
@@ -613,6 +613,8 @@ do
|
|||||||
if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
|
if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
util.buf_versions[bufnr] = changedtick
|
||||||
-- Lazy initialize these because clients may not even need them.
|
-- Lazy initialize these because clients may not even need them.
|
||||||
local incremental_changes = once(function(client)
|
local incremental_changes = once(function(client)
|
||||||
local size_index = encoding_index[client.offset_encoding]
|
local size_index = encoding_index[client.offset_encoding]
|
||||||
|
@@ -135,7 +135,7 @@ function M.apply_text_document_edit(text_document_edit)
|
|||||||
local text_document = text_document_edit.textDocument
|
local text_document = text_document_edit.textDocument
|
||||||
local bufnr = vim.uri_to_bufnr(text_document.uri)
|
local bufnr = vim.uri_to_bufnr(text_document.uri)
|
||||||
-- TODO(ashkan) check this is correct.
|
-- TODO(ashkan) check this is correct.
|
||||||
if api.nvim_buf_get_changedtick(bufnr) > text_document.version then
|
if (M.buf_versions[bufnr] or 0) > text_document.version then
|
||||||
print("Buffer ", text_document.uri, " newer than edits.")
|
print("Buffer ", text_document.uri, " newer than edits.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -868,5 +868,7 @@ function M.character_offset(buf, row, col)
|
|||||||
return str_utfindex(line, col)
|
return str_utfindex(line, col)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.buf_versions = {}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
-- vim:sw=2 ts=2 et
|
-- vim:sw=2 ts=2 et
|
||||||
|
Reference in New Issue
Block a user