vim.loop → vim.uv

This commit is contained in:
Felipe Lema 2024-08-21 08:57:03 -04:00
parent 7df7f3721c
commit 1c883336a7

View File

@ -113,13 +113,13 @@ source._dirname = function(self, params, option)
end end
source._candidates = function(_, dirname, include_hidden, option, callback) source._candidates = function(_, dirname, include_hidden, option, callback)
local entries, err = vim.loop.fs_scandir(dirname) local entries, err = vim.uv.fs_scandir(dirname)
if err then if err then
return callback(err, nil) return callback(err, nil)
end end
local work local work
work = assert(vim.loop.new_work( work = assert(vim.uv.new_work(
function(_entries, _dirname, _include_hidden, function(_entries, _dirname, _include_hidden,
label_trailing_slash, trailing_slash, label_trailing_slash, trailing_slash,
file_kind, folder_kind) file_kind, folder_kind)
@ -131,13 +131,13 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
end end
local path = _dirname .. '/' .. name local path = _dirname .. '/' .. name
local stat = assert(vim.loop.fs_stat)(path) local stat = assert(vim.uv.fs_stat)(path)
local lstat = nil local lstat = nil
if stat then if stat then
fs_type = stat.type fs_type = stat.type
elseif fs_type == 'link' then elseif fs_type == 'link' then
-- Broken symlink -- Broken symlink
lstat = assert(vim.loop.fs_lstat)(_dirname) lstat = assert(vim.uv.fs_lstat)(_dirname)
if not lstat then if not lstat then
return return
end end
@ -169,7 +169,7 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
end end
while true do while true do
local name, fs_type, e = assert(vim.loop.fs_scandir_next)(_entries) local name, fs_type, e = assert(vim.uv.fs_scandir_next)(_entries)
if e then if e then
return fs_type, "" return fs_type, ""
end end