aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 3973e606f8..d2a5d9a08e 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -710,11 +710,12 @@ function M.rename(old_fname, new_fname, opts)
end
for _, b in ipairs(oldbufs) do
- vim.fn.bufload(b)
- -- The there may be pending changes in the buffer
- api.nvim_buf_call(b, function()
- vim.cmd('w!')
- end)
+ -- There may be pending changes in the buffer
+ if api.nvim_buf_is_loaded(b) then
+ api.nvim_buf_call(b, function()
+ vim.cmd('update!')
+ end)
+ end
end
local newdir = assert(vim.fs.dirname(new_fname))