aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorAndreas Johansson <ndreas@users.noreply.github.com>2020-06-14 21:23:16 +0200
committerGitHub <noreply@github.com>2020-06-14 15:23:16 -0400
commit44fe8828f06a22bc9aa3617a6fd8aae447a838de (patch)
tree2b5b360c42dde8fbebdcf9f1289bd0b9603e2ca6 /runtime/lua/vim/lsp/util.lua
parenta0a84fc9e0ba8631db35cfd7aa6a458fbdd80417 (diff)
downloadrneovim-44fe8828f06a22bc9aa3617a6fd8aae447a838de.tar.gz
rneovim-44fe8828f06a22bc9aa3617a6fd8aae447a838de.tar.bz2
rneovim-44fe8828f06a22bc9aa3617a6fd8aae447a838de.zip
lsp: Fix text edits with the same start position (#12434)
According to the LSP spec[1], multiple edits can have the same starting position, and if that is the case, they should be applied in the order as they come in the array. The implementation uses a reverse sort to not interfere with non applied edits, but failed to take into account the spec. [1] https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textedit
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index a4ceeb34e6..4c3c4fa6cb 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -92,7 +92,7 @@ local function sort_by_key(fn)
end
end
local edit_sort_key = sort_by_key(function(e)
- return {e.A[1], e.A[2], e.i}
+ return {e.A[1], e.A[2], -e.i}
end)
--- Position is a https://microsoft.github.io/language-server-protocol/specifications/specification-current/#position