diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index b5e15e135c..86bef1ac8a 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -693,6 +693,9 @@ function M.rename(old_fname, new_fname, opts) end) end + local newdir = assert(vim.fs.dirname(new_fname)) + vim.fn.mkdir(newdir, 'p') + local ok, err = os.rename(old_fname, new_fname) assert(ok, err)