aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua21
1 files changed, 5 insertions, 16 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 3215b40d1d..fc027cfcc0 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -502,11 +502,6 @@ function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
should_check_version = false
end
- -- changedtick increases on save but server only receives version updates
- -- on line changes (via didChange)
- -- This allows a gap of 1 to account for the servers outdated view
- local version_offset = vim.b[bufnr].modified and 0 or 1
-
-- `VersionedTextDocumentIdentifier`s version may be null
-- https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
if
@@ -514,7 +509,8 @@ function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
and (
text_document.version
and text_document.version > 0
- and vim.b[bufnr].changedtick > (text_document.version + version_offset)
+ and M.buf_versions[bufnr]
+ and M.buf_versions[bufnr] > text_document.version
)
then
print('Buffer ', text_document.uri, ' newer than edits.')
@@ -2206,16 +2202,9 @@ function M._refresh(method, opts)
end
end
----@nodoc
----@deprecated
----@type table<integer,integer>
-M.buf_versions = setmetatable({}, {
- __index = function(_, bufnr)
- vim.deprecate('vim.lsp.util.buf_versions', 'vim.b.changedtick', '0.13')
- return vim.b[bufnr].changedtick
- end,
-})
-
M._get_line_byte_from_position = get_line_byte_from_position
+---@nodoc
+M.buf_versions = {} ---@type table<integer,integer>
+
return M