File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
lua/nvim-tree/actions/tree/modifiers Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 29
29
--- @param expansion_count integer
30
30
--- @param node Node
31
31
--- @return boolean
32
- local function should_expand (expansion_count , node )
32
+ local function expand_until_max_or_empty (expansion_count , node )
33
33
local should_halt = expansion_count >= M .MAX_FOLDER_DISCOVERY
34
34
local should_exclude = M .EXCLUDE [node .name ]
35
35
return not should_halt and node .nodes and not node .open and not should_exclude
36
36
end
37
37
38
- local function gen_iterator ()
38
+ local function gen_iterator (should_expand )
39
39
local expansion_count = 0
40
40
41
41
return function (parent )
@@ -64,9 +64,10 @@ local function gen_iterator()
64
64
end
65
65
66
66
--- @param base_node table
67
- function M .fn (base_node )
67
+ function M .fn (base_node , expand_until )
68
+ expand_until = expand_until or expand_until_max_or_empty
68
69
local node = base_node .nodes and base_node or core .get_explorer ()
69
- if gen_iterator ()(node ) then
70
+ if gen_iterator (expand_until )(node ) then
70
71
notify .warn (" expansion iteration was halted after " .. M .MAX_FOLDER_DISCOVERY .. " discovered folders" )
71
72
end
72
73
renderer .draw ()
You can’t perform that action at this time.
0 commit comments