feat(lua): rename vim.loop -> vim.uv (#22846)

This commit is contained in:
Lewis Russell
2023-06-03 11:06:00 +01:00
committed by GitHub
parent c65e2203f7
commit 2db719f6c2
41 changed files with 147 additions and 145 deletions

View File

@@ -1,6 +1,6 @@
local M = {}
local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
--- Iterate over all the parents of the given file or directory.
---
@@ -106,12 +106,12 @@ function M.dir(path, opts)
})
if not opts.depth or opts.depth == 1 then
local fs = vim.loop.fs_scandir(M.normalize(path))
local fs = vim.uv.fs_scandir(M.normalize(path))
return function()
if not fs then
return
end
return vim.loop.fs_scandir_next(fs)
return vim.uv.fs_scandir_next(fs)
end
end
@@ -121,9 +121,9 @@ function M.dir(path, opts)
while #dirs > 0 do
local dir0, level = unpack(table.remove(dirs, 1))
local dir = level == 1 and dir0 or M.joinpath(path, dir0)
local fs = vim.loop.fs_scandir(M.normalize(dir))
local fs = vim.uv.fs_scandir(M.normalize(dir))
while fs do
local name, t = vim.loop.fs_scandir_next(fs)
local name, t = vim.uv.fs_scandir_next(fs)
if not name then
break
end
@@ -158,7 +158,7 @@ end
--- -- location of Cargo.toml from the current buffer's path
--- local cargo = vim.fs.find('Cargo.toml', {
--- upward = true,
--- stop = vim.loop.os_homedir(),
--- stop = vim.uv.os_homedir(),
--- path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
--- })
---
@@ -212,7 +212,7 @@ function M.find(names, opts)
names = type(names) == 'string' and { names } or names
local path = opts.path or vim.loop.cwd()
local path = opts.path or vim.uv.cwd()
local stop = opts.stop
local limit = opts.limit or 1
@@ -244,7 +244,7 @@ function M.find(names, opts)
local t = {}
for _, name in ipairs(names) do
local f = M.joinpath(p, name)
local stat = vim.loop.fs_stat(f)
local stat = vim.uv.fs_stat(f)
if stat and (not opts.type or opts.type == stat.type) then
t[#t + 1] = f
end
@@ -337,7 +337,7 @@ function M.normalize(path, opts)
})
if path:sub(1, 1) == '~' then
local home = vim.loop.os_homedir() or '~'
local home = vim.uv.os_homedir() or '~'
if home:sub(-1) == '\\' or home:sub(-1) == '/' then
home = home:sub(1, -2)
end
@@ -345,7 +345,7 @@ function M.normalize(path, opts)
end
if opts.expand_env == nil or opts.expand_env then
path = path:gsub('%$([%w_]+)', vim.loop.os_getenv)
path = path:gsub('%$([%w_]+)', vim.uv.os_getenv)
end
path = path:gsub('\\', '/'):gsub('/+', '/')