fix(#2154): find_file doesn't work when group_empty option is enabled (#2100)

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Zhanibek Adilbekov
2023-04-29 13:03:20 +06:00
committed by GitHub
parent 74996b8626
commit d8b154c5f0
8 changed files with 28 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ local core = require "nvim-tree.core"
local renderer = require "nvim-tree.renderer"
local Iterator = require "nvim-tree.iterators.node-iterator"
local notify = require "nvim-tree.notify"
local lib = require "nvim-tree.lib"
local M = {}
@@ -15,6 +16,7 @@ local function to_lookup_table(list)
end
local function expand(node)
node = lib.get_last_group_node(node)
node.open = true
if #node.nodes == 0 then
core.get_explorer():expand(node)
@@ -45,7 +47,8 @@ local function gen_iterator()
end
end)
:recursor(function(node)
return expansion_count < M.MAX_FOLDER_DISCOVERY and node.open and node.nodes
return expansion_count < M.MAX_FOLDER_DISCOVERY
and (node.group_next and { node.group_next } or (node.open and node.nodes))
end)
:iterate()