* add type fallback for nil types * add PR suggestions * Update lua/nvim-tree/explorer/explore.lua Co-authored-by: Alexander Courtis <alex@courtis.org> * use type from fs_stat for sshfs compatibility --------- Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -29,7 +29,7 @@ local function populate_children(handle, cwd, node, git_status, parent)
|
||||
})
|
||||
|
||||
while true do
|
||||
local name, t = vim.loop.fs_scandir_next(handle)
|
||||
local name, _ = vim.loop.fs_scandir_next(handle)
|
||||
if not name then
|
||||
break
|
||||
end
|
||||
@@ -41,14 +41,18 @@ local function populate_children(handle, cwd, node, git_status, parent)
|
||||
|
||||
---@type uv.fs_stat.result|nil
|
||||
local stat = vim.loop.fs_stat(abs)
|
||||
|
||||
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
|
||||
local type = stat and stat.type or nil
|
||||
|
||||
local filter_reason = parent.filters:should_filter_as_reason(abs, stat, filter_status)
|
||||
if filter_reason == FILTER_REASON.none and not nodes_by_path[abs] then
|
||||
local child = nil
|
||||
if t == "directory" and vim.loop.fs_access(abs, "R") then
|
||||
if type == "directory" and vim.loop.fs_access(abs, "R") then
|
||||
child = builders.folder(node, abs, name, stat)
|
||||
elseif t == "file" then
|
||||
elseif type == "file" then
|
||||
child = builders.file(node, abs, name, stat)
|
||||
elseif t == "link" then
|
||||
elseif type == "link" then
|
||||
local link = builders.link(node, abs, name, stat)
|
||||
if link.link_to ~= nil then
|
||||
child = link
|
||||
|
||||
Reference in New Issue
Block a user