aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2021-05-21 09:06:00 +0200
committerFolke Lemaitre <folke.lemaitre@gmail.com>2021-05-21 09:06:00 +0200
commitd09f53d8ec1dd7be1822c68df1061c747c16e5ec (patch)
tree5d9aa651ce4b219d85c81232503c88d5be443485 /runtime/lua/vim/lsp/util.lua
parentde96626ad4594414397845d77623a597b170ef24 (diff)
downloadrneovim-d09f53d8ec1dd7be1822c68df1061c747c16e5ec.tar.gz
rneovim-d09f53d8ec1dd7be1822c68df1061c747c16e5ec.tar.bz2
rneovim-d09f53d8ec1dd7be1822c68df1061c747c16e5ec.zip
fix(lsp): allow apply_text_edits and set_lines to insert text after the last line. Fixes #14017
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 e403a8ee1b..417a3cdb88 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -73,7 +73,7 @@ function M.set_lines(lines, A, B, new_lines)
-- way the LSP describes the range including the last newline is by
-- specifying a line number after what we would call the last line.
local i_n = math.min(B[1] + 1, #lines)
- if not (i_0 >= 1 and i_0 <= #lines and i_n >= 1 and i_n <= #lines) then
+ if not (i_0 >= 1 and i_0 <= #lines + 1 and i_n >= 1 and i_n <= #lines) then
error("Invalid range: "..vim.inspect{A = A; B = B; #lines, new_lines})
end
local prefix = ""