aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-05-22 09:13:06 -0700
committerGitHub <noreply@github.com>2021-05-22 09:13:06 -0700
commit9c7ad330065b4e8b25dffc43f4829b2a23af681f (patch)
tree136054f6508178746ce6b5f0c0ce3d7e2eb4c186 /runtime/lua/vim/lsp/util.lua
parent449bbf5540886a9b892b551162080e2dc9a37990 (diff)
parentd09f53d8ec1dd7be1822c68df1061c747c16e5ec (diff)
downloadrneovim-9c7ad330065b4e8b25dffc43f4829b2a23af681f.tar.gz
rneovim-9c7ad330065b4e8b25dffc43f4829b2a23af681f.tar.bz2
rneovim-9c7ad330065b4e8b25dffc43f4829b2a23af681f.zip
Merge pull request #14603 from folke/format_on_save
fix(lsp): allow apply_text_edits to append text (insert at last line)
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 2ae9be57c0..ea54290ec3 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 = ""