File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
lua/nvim-tree/actions/tree/modifiers Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 2828
2929--- @param expansion_count integer
3030--- @param node Node
31- --- @return boolean
31+ --- @return boolean , function
3232local function expand_until_max_or_empty (expansion_count , node )
3333 local should_halt = expansion_count >= M .MAX_FOLDER_DISCOVERY
3434 local should_exclude = M .EXCLUDE [node .name ]
35- return not should_halt and node .nodes and not node .open and not should_exclude
35+ local result = not should_halt and node .nodes and not node .open and not should_exclude
36+ return result , expand_until_max_or_empty
3637end
3738
38- local function gen_iterator (should_expand )
39+ local function gen_iterator (should_expand_fn )
3940 local expansion_count = 0
4041
4142 return function (parent )
@@ -47,7 +48,9 @@ local function gen_iterator(should_expand)
4748 Iterator .builder (parent .nodes )
4849 :hidden ()
4950 :applier (function (node )
50- if should_expand (expansion_count , node ) then
51+ local should_expand , should_expand_next_fn = should_expand_fn (expansion_count , node )
52+ should_expand_fn = should_expand_next_fn
53+ if should_expand then
5154 expansion_count = expansion_count + 1
5255 expand (node )
5356 end
You can’t perform that action at this time.
0 commit comments