mirror of
https://github.com/neovim/neovim.git
synced 2025-12-07 15:14:04 +00:00
fix(lsp): check if the buffer is a directory before w! it (#22289)
This commit is contained in:
@@ -759,9 +759,11 @@ function M.rename(old_fname, new_fname, opts)
|
||||
vim.fn.bufload(oldbuf)
|
||||
|
||||
-- The there may be pending changes in the buffer
|
||||
api.nvim_buf_call(oldbuf, function()
|
||||
vim.cmd('w!')
|
||||
end)
|
||||
if vim.fn.isdirectory(old_fname) == 0 then
|
||||
api.nvim_buf_call(oldbuf, function()
|
||||
vim.cmd('w!')
|
||||
end)
|
||||
end
|
||||
|
||||
local ok, err = os.rename(old_fname, new_fname)
|
||||
assert(ok, err)
|
||||
|
||||
Reference in New Issue
Block a user