mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
fix(lsp): revert buf_versions deprecation/replacement (#29217)
* Revert "fix(lsp): account for changedtick version gap on modified reset (#29170)" This reverts commit2e6d295f79
. * Revert "refactor(lsp): replace util.buf_versions with changedtick (#28943)" This reverts commit5c33815448
.
This commit is contained in:

committed by
GitHub

parent
6c7677e5d2
commit
6e45cd7f00
@@ -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
|
||||
|
Reference in New Issue
Block a user