aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/lua/vim/lsp/util.lua2
-rw-r--r--test/functional/plugin/lsp_spec.lua12
2 files changed, 7 insertions, 7 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index fc027cfcc0..3d61af8b15 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -391,7 +391,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
return a.range.start.character > b.range.start.character
end
if a._index ~= b._index then
- return a._index > b._index
+ return a._index < b._index
end
end)
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 0cf84b50c2..6d28b83be8 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -1789,9 +1789,9 @@ describe('LSP', function()
}
exec_lua('vim.lsp.util.apply_text_edits(...)', edits, 1, 'utf-16')
eq({
- '',
- '123',
- 'fooFbar',
+ '3',
+ 'foo',
+ '12Fbar',
'123irst guy',
'baz line of text',
'The next line of text',
@@ -1813,9 +1813,9 @@ describe('LSP', function()
}
exec_lua('vim.lsp.util.apply_text_edits(...)', edits, 1, 'utf-16')
eq({
- '',
- '123',
- 'fooFbar',
+ '3',
+ 'foo',
+ '12Fbar',
'123irst guy',
'baz line of text',
'The next line of text',