fix(#1831): improve fs_scandir error handling, add profiling

This commit is contained in:
Alexander Courtis
2022-12-17 16:59:09 +11:00
parent 87409bb4af
commit 89c79cb33b
5 changed files with 62 additions and 14 deletions

View File

@@ -7,8 +7,8 @@ local M = {
}
function M.folder(parent, absolute_path, name)
local handle = vim.loop.fs_scandir(absolute_path)
local has_children = handle and vim.loop.fs_scandir_next(handle) ~= nil
local handle = utils.fs_scandir_profiled(absolute_path)
local has_children = handle and utils.fs_scandir_next_profiled(handle, absolute_path) ~= nil
local node = {
type = "directory",
@@ -71,8 +71,8 @@ function M.link(parent, absolute_path, name)
local is_dir_link = (link_to ~= nil) and vim.loop.fs_stat(link_to).type == "directory"
if is_dir_link then
local handle = vim.loop.fs_scandir(link_to)
has_children = handle and vim.loop.fs_scandir_next(handle) ~= nil
local handle = utils.fs_scandir_profiled(link_to)
has_children = handle and utils.fs_scandir_next_profiled(handle, link_to) ~= nil
open = false
nodes = {}
end