File tree 2 files changed +17
-4
lines changed
2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,18 @@ local function buf_match()
23
23
end
24
24
end
25
25
26
- --- @param node Node
27
- --- @param keep_buffers boolean
28
- function M .fn (node , keep_buffers )
26
+ --- @param node Node | boolean | nil legacy -> opts.keep_buffers
27
+ --- @param opts ApiTreeCollapseAllOpts | nil
28
+ function M .fn (node , opts )
29
+ -- legacy arguments
30
+ if type (node ) == " boolean" then
31
+ opts = {
32
+ keep_buffers = node ,
33
+ }
34
+ node = nil
35
+ end
36
+ opts = opts or {}
37
+
29
38
local explorer = core .get_explorer ()
30
39
if not explorer then
31
40
return
@@ -51,7 +60,7 @@ function M.fn(node, keep_buffers)
51
60
:applier (function (n )
52
61
local dir = n :as (DirectoryNode )
53
62
if dir then
54
- dir .open = keep_buffers and matches (dir .absolute_path )
63
+ dir .open = opts . keep_buffers and matches (dir .absolute_path )
55
64
end
56
65
end )
57
66
:recursor (function (n )
Original file line number Diff line number Diff line change @@ -182,6 +182,10 @@ Api.tree.get_nodes = wrap_explorer("get_nodes")
182
182
183
183
Api .tree .find_file = wrap (actions .tree .find_file .fn )
184
184
Api .tree .search_node = wrap (actions .finders .search_node .fn )
185
+
186
+ --- @class ApiTreeCollapseAllOpts
187
+ --- @field keep_buffers boolean | nil default false
188
+
185
189
Api .tree .collapse_all = wrap (actions .tree .modifiers .collapse_all .fn )
186
190
Api .tree .expand_all = wrap_node (actions .tree .modifiers .expand_all .fn )
187
191
Api .tree .toggle_enable_filters = wrap_explorer_member (" filters" , " toggle" )
You can’t perform that action at this time.
0 commit comments