mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
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
This commit is contained in:
committed by
GitHub
parent
a0a84fc9e0
commit
44fe8828f0
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user