Skip to content

Commit e0166d1

Browse files
authored
fix(#1831): remove instrumentation (#1968)
1 parent 8505b6e commit e0166d1

File tree

4 files changed

+7
-55
lines changed

4 files changed

+7
-55
lines changed

lua/nvim-tree/explorer/explore.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ local function populate_children(handle, cwd, node, git_status)
1919
local nodes_by_path = utils.bool_record(node.nodes, "absolute_path")
2020
local filter_status = filters.prepare(git_status)
2121
while true do
22-
local name, t = utils.fs_scandir_next_profiled(handle, cwd)
22+
local name, t = vim.loop.fs_scandir_next(handle)
2323
if not name then
2424
break
2525
end

lua/nvim-tree/explorer/node-builders.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ local watch = require "nvim-tree.explorer.watch"
44
local M = {}
55

66
function M.folder(parent, absolute_path, name)
7-
local handle = utils.fs_scandir_profiled(absolute_path)
8-
local has_children = handle and utils.fs_scandir_next_profiled(handle, absolute_path) ~= nil
7+
local handle = vim.loop.fs_scandir(absolute_path)
8+
local has_children = handle and vim.loop.fs_scandir_next(handle) ~= nil
99

1010
local node = {
1111
type = "directory",
@@ -63,8 +63,8 @@ function M.link(parent, absolute_path, name)
6363
local is_dir_link = (link_to ~= nil) and vim.loop.fs_stat(link_to).type == "directory"
6464

6565
if is_dir_link then
66-
local handle = utils.fs_scandir_profiled(link_to)
67-
has_children = handle and utils.fs_scandir_next_profiled(handle, link_to) ~= nil
66+
local handle = vim.loop.fs_scandir(link_to)
67+
has_children = handle and vim.loop.fs_scandir_next(handle) ~= nil
6868
open = false
6969
nodes = {}
7070
end

lua/nvim-tree/explorer/reload.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ end
3636

3737
function M.reload(node, git_status, unloaded_bufnr)
3838
local cwd = node.link_to or node.absolute_path
39-
local handle = utils.fs_scandir_profiled(cwd)
39+
local handle = vim.loop.fs_scandir(cwd)
4040
if not handle then
4141
return
4242
end
@@ -55,7 +55,7 @@ function M.reload(node, git_status, unloaded_bufnr)
5555
local node_ignored = explorer_node.is_git_ignored(node)
5656
local nodes_by_path = utils.key_by(node.nodes, "absolute_path")
5757
while true do
58-
local name, t = utils.fs_scandir_next_profiled(handle, cwd)
58+
local name, t = vim.loop.fs_scandir_next(handle, cwd)
5959
if not name then
6060
break
6161
end

lua/nvim-tree/utils.lua

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
local Iterator = require "nvim-tree.iterators.node-iterator"
22
local notify = require "nvim-tree.notify"
3-
local log = require "nvim-tree.log"
43

54
local M = {
65
debouncers = {},
@@ -415,51 +414,4 @@ function M.is_nvim_tree_buf(bufnr)
415414
return false
416415
end
417416

418-
---Profile a call to vim.loop.fs_scandir
419-
---This should be removed following resolution of #1831
420-
---@param path string
421-
---@return userdata|nil uv_fs_t
422-
---@return string|nil type
423-
---@return string|nil err (fail)
424-
---@return string|nil name (fail)
425-
function M.fs_scandir_profiled(path)
426-
local pn = string.format("fs_scandir %s", path)
427-
local ps = log.profile_start(pn)
428-
429-
local handle, err, name = vim.loop.fs_scandir(path)
430-
431-
if err or name then
432-
log.line("profile", " %s err '%s'", pn, vim.inspect(err))
433-
log.line("profile", " %s name '%s'", pn, vim.inspect(name))
434-
end
435-
436-
log.profile_end(ps, pn)
437-
438-
return handle, err, name
439-
end
440-
441-
---Profile a call to vim.loop.fs_scandir_next
442-
---This should be removed following resolution of #1831
443-
---@param handle userdata uv_fs_t
444-
---@param tag string arbitrary
445-
---@return string|nil name
446-
---@return string|nil type
447-
---@return string|nil err (fail)
448-
---@return string|nil name (fail)
449-
function M.fs_scandir_next_profiled(handle, tag)
450-
local pn = string.format("fs_scandir_next %s", tag)
451-
local ps = log.profile_start(pn)
452-
453-
local n, t, err, name = vim.loop.fs_scandir_next(handle)
454-
455-
if err or name then
456-
log.line("profile", " %s err '%s'", pn, vim.inspect(err))
457-
log.line("profile", " %s name '%s'", pn, vim.inspect(name))
458-
end
459-
460-
log.profile_end(ps, pn)
461-
462-
return n, t, err, name
463-
end
464-
465417
return M

0 commit comments

Comments
 (0)