aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorTim Pope <code@tpope.net>2022-03-02 14:33:02 -0500
committerGitHub <noreply@github.com>2022-03-02 11:33:02 -0800
commitd477788cd5bfd36b6be88e4ea736e5053369252b (patch)
tree0702d46ba6b27eae71872993f162c928848f12aa /runtime/lua/vim/lsp/util.lua
parent482ea0cc175937fd199d5e1a1947ea73d1a38593 (diff)
downloadrneovim-d477788cd5bfd36b6be88e4ea736e5053369252b.tar.gz
rneovim-d477788cd5bfd36b6be88e4ea736e5053369252b.tar.bz2
rneovim-d477788cd5bfd36b6be88e4ea736e5053369252b.zip
fix(lsp): respect all of 'fixeol', 'eol', and 'binary' applying edits (#17574)
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 655c3a4679..59ab3d7e1f 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -480,7 +480,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
-- Remove final line if needed
local fix_eol = has_eol_text_edit
- fix_eol = fix_eol and api.nvim_buf_get_option(bufnr, 'fixeol')
+ fix_eol = fix_eol and (api.nvim_buf_get_option(bufnr, 'eol') or (api.nvim_buf_get_option(bufnr, 'fixeol') and not api.nvim_buf_get_option('binary')))
fix_eol = fix_eol and get_line(bufnr, max - 1) == ''
if fix_eol then
vim.api.nvim_buf_set_lines(bufnr, -2, -1, false, {})