Skip to content

fix(#2794): sshfs compatibility #2893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions lua/nvim-tree/explorer/explore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = (vim.loop.fs_stat(abs) or {}).type

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
Expand Down
Loading