fix: replace vim.* "requires" with explicit calls to vim functions (#1701)
This commit is contained in:
committed by
GitHub
parent
6d6a44626d
commit
8cc369695b
@@ -1,5 +1,3 @@
|
||||
local uv = vim.loop
|
||||
|
||||
local utils = require "nvim-tree.utils"
|
||||
local builders = require "nvim-tree.explorer.node-builders"
|
||||
local common = require "nvim-tree.explorer.common"
|
||||
@@ -21,7 +19,7 @@ end
|
||||
|
||||
function M.reload(node, status)
|
||||
local cwd = node.link_to or node.absolute_path
|
||||
local handle = uv.fs_scandir(cwd)
|
||||
local handle = vim.loop.fs_scandir(cwd)
|
||||
if type(handle) == "string" then
|
||||
notify.error(handle)
|
||||
return
|
||||
@@ -37,7 +35,7 @@ function M.reload(node, status)
|
||||
local node_ignored = node.git_status == "!!"
|
||||
local nodes_by_path = utils.key_by(node.nodes, "absolute_path")
|
||||
while true do
|
||||
local ok, name, t = pcall(uv.fs_scandir_next, handle)
|
||||
local ok, name, t = pcall(vim.loop.fs_scandir_next, handle)
|
||||
if not ok or not name then
|
||||
break
|
||||
end
|
||||
@@ -48,7 +46,7 @@ function M.reload(node, status)
|
||||
return stat
|
||||
end
|
||||
|
||||
stat = uv.fs_stat(path)
|
||||
stat = vim.loop.fs_stat(path)
|
||||
return stat
|
||||
end
|
||||
|
||||
@@ -69,7 +67,7 @@ function M.reload(node, status)
|
||||
end
|
||||
|
||||
if not nodes_by_path[abs] then
|
||||
if t == "directory" and uv.fs_access(abs, "R") then
|
||||
if t == "directory" and vim.loop.fs_access(abs, "R") then
|
||||
local folder = builders.folder(node, abs, name)
|
||||
nodes_by_path[abs] = folder
|
||||
table.insert(node.nodes, folder)
|
||||
|
||||
Reference in New Issue
Block a user