feat: refactor all vim.loop -> vim.uv and add a shim when needed

This commit is contained in:
Folke Lemaitre 2024-03-22 08:58:36 +01:00
parent 83493db50a
commit 9e157df077
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
19 changed files with 53 additions and 51 deletions

View file

@ -28,8 +28,8 @@ describe("lazy", function()
"folke/paint.nvim",
}, { install_missing = true, defaults = { lazy = true } })
assert(3 == vim.tbl_count(Config.plugins))
assert(vim.loop.fs_stat(root .. "/paint.nvim/README.md"))
assert(vim.loop.fs_stat(root .. "/neodev.nvim/README.md"))
assert(vim.uv.fs_stat(root .. "/paint.nvim/README.md"))
assert(vim.uv.fs_stat(root .. "/neodev.nvim/README.md"))
assert(not neodev)
assert(Config.plugins["neodev.nvim"]._.installed)
assert(not Config.plugins["neodev.nvim"]._.is_local)

View file

@ -12,7 +12,7 @@ describe("util", function()
end
end
Helpers.fs_rm("")
assert(not vim.loop.fs_stat(Helpers.path("")), "fs root should be deleted")
assert(not vim.uv.fs_stat(Helpers.path("")), "fs root should be deleted")
end)
it("lsmod lists all mods in dir", function()
@ -85,7 +85,7 @@ describe("util", function()
assert.same(Helpers.path("old/lua/foobar"), root)
Helpers.fs_rm("old")
assert(not vim.loop.fs_stat(Helpers.path("old/lua/foobar")), "old/lua/foobar should not exist")
assert(not vim.uv.fs_stat(Helpers.path("old/lua/foobar")), "old/lua/foobar should not exist")
-- vim.opt.rtp = rtp
vim.opt.rtp:append(Helpers.path("new"))

View file

@ -26,12 +26,12 @@ function M.fs_rm(dir)
dir = Util.norm(M.fs_root .. "/" .. dir)
Util.walk(dir, function(path, _, type)
if type == "directory" then
vim.loop.fs_rmdir(path)
vim.uv.fs_rmdir(path)
else
vim.loop.fs_unlink(path)
vim.uv.fs_unlink(path)
end
end)
vim.loop.fs_rmdir(dir)
vim.uv.fs_rmdir(dir)
end
return M

View file

@ -9,7 +9,7 @@ end
function M.load(plugin)
local name = plugin:match(".*/(.*)")
local package_root = M.root(".tests/site/pack/deps/start/")
if not vim.loop.fs_stat(package_root .. name) then
if not vim.uv.fs_stat(package_root .. name) then
print("Installing " .. plugin)
vim.fn.mkdir(package_root, "p")
vim.fn.system({