Skip to content

Commit ada6a3d

Browse files
committed
fix(files): ensure paths_to_load does not include nested files, fixes #286
1 parent fae9fe5 commit ada6a3d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/neo-tree/sources/filesystem/lib/fs_scan.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ M.get_items = function(state, parent_id, path_to_reveal, callback, async)
230230
elseif state.tree then
231231
context.paths_to_load = renderer.get_expanded_nodes(state.tree, state.path)
232232
end
233+
-- Ensure that there are no nested files in the list of folders to load
234+
context.paths_to_load = vim.tbl_filter(function(p)
235+
local stats = vim.loop.fs_stat(p)
236+
return stats and stats.type == "directory"
237+
end, context.paths_to_load)
233238
if path_to_reveal then
234239
-- be sure to load all of the folders leading up to the path to reveal
235240
local path_to_reveal_parts = utils.split(path_to_reveal, utils.path_separator)

0 commit comments

Comments
 (0)