diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2024-06-04 17:21:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 17:21:37 +0200 |
commit | 2e6d295f799c27372e5c0c44727fa613c81717fd (patch) | |
tree | 73691edf3ee84eb23f703ae20aeb29ee141af1a0 /test/functional | |
parent | b66106a46c5c6180c7f80852a8c822b400e73100 (diff) | |
download | rneovim-2e6d295f799c27372e5c0c44727fa613c81717fd.tar.gz rneovim-2e6d295f799c27372e5c0c44727fa613c81717fd.tar.bz2 rneovim-2e6d295f799c27372e5c0c44727fa613c81717fd.zip |
fix(lsp): account for changedtick version gap on modified reset (#29170)
Follow up to https://github.com/neovim/neovim/pull/28943
Fixes https://github.com/neovim/neovim/issues/29163
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 85891e59b5..23f6b733d5 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -2133,15 +2133,13 @@ describe('LSP', function() }, buf_lines(target_bufnr)) end) 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) exec_lua( [[ local args = {...} - local versionedBuf = args[2] vim.lsp.util.apply_text_document_edit(args[1], nil, 'utf-16') ]], - edit, - versionedBuf + edit ) end @@ -2153,17 +2151,17 @@ describe('LSP', function() eq(baseText, buf_lines(target_bufnr)) -- Apply an edit for an old version, should skip - apply_edit_mocking_current_version( - text_document_edit(2), - { currentVersion = 7, bufnr = target_bufnr } - ) + apply_edit_mocking_current_version(text_document_edit(1)) eq(baseText, buf_lines(target_bufnr)) -- no change -- Sanity check that next version to current does apply change - apply_edit_mocking_current_version( - text_document_edit(8), - { currentVersion = 7, bufnr = target_bufnr } - ) + apply_edit_mocking_current_version(text_document_edit(exec_lua( + [[ + local bufnr = ... + return vim.b[bufnr].changedtick + ]], + target_bufnr + ))) eq({ 'First ↥ 🤦 🦄 line of text', '2nd line of 语text', |