mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
lsp: Remove vim.NIL handling from apply_text_document_edit
The rpc layer normalizes `vim.NIL` to `nil`, so the scenario tested should never happen.
This commit is contained in:
@@ -470,7 +470,6 @@ function M.apply_text_document_edit(text_document_edit, index)
|
|||||||
-- `VersionedTextDocumentIdentifier`s version may be null
|
-- `VersionedTextDocumentIdentifier`s version may be null
|
||||||
-- https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
|
-- https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier
|
||||||
if should_check_version and (text_document.version
|
if should_check_version and (text_document.version
|
||||||
and text_document.version ~= vim.NIL
|
|
||||||
and text_document.version > 0
|
and text_document.version > 0
|
||||||
and M.buf_versions[bufnr]
|
and M.buf_versions[bufnr]
|
||||||
and M.buf_versions[bufnr] > text_document.version) then
|
and M.buf_versions[bufnr] > text_document.version) then
|
||||||
|
|||||||
@@ -1137,19 +1137,6 @@ describe('LSP', function()
|
|||||||
'2nd line of 语text';
|
'2nd line of 语text';
|
||||||
}, buf_lines(target_bufnr))
|
}, buf_lines(target_bufnr))
|
||||||
end)
|
end)
|
||||||
it('correctly goes ahead with the edit if the version is vim.NIL', function()
|
|
||||||
-- we get vim.NIL when we decode json null value.
|
|
||||||
local json = exec_lua[[
|
|
||||||
return vim.fn.json_decode("{ \"a\": 1, \"b\": null }")
|
|
||||||
]]
|
|
||||||
eq(json.b, exec_lua("return vim.NIL"))
|
|
||||||
|
|
||||||
exec_lua('vim.lsp.util.apply_text_document_edit(...)', text_document_edit(exec_lua("return vim.NIL")))
|
|
||||||
eq({
|
|
||||||
'First ↥ 🤦 🦄 line of text';
|
|
||||||
'2nd line of 语text';
|
|
||||||
}, buf_lines(target_bufnr))
|
|
||||||
end)
|
|
||||||
it('skips the edit if the version of the edit is behind the local buffer ', function()
|
it('skips the edit if the version of the edit is behind the local buffer ', function()
|
||||||
local apply_edit_mocking_current_version = function(edit, versionedBuf)
|
local apply_edit_mocking_current_version = function(edit, versionedBuf)
|
||||||
exec_lua([[
|
exec_lua([[
|
||||||
|
|||||||
Reference in New Issue
Block a user