@@ -6,31 +6,34 @@ local explorer_node = require "nvim-tree.explorer.node"
66
77local M = {}
88
9- --- @param where string
10- --- @param what string
9+ --- @class NavigationItemOpts
10+ --- @field where string
11+ --- @field what string
12+
13+ --- @param opts NavigationItemOpts
1114--- @return fun ()
12- function M .fn (where , what )
15+ function M .fn (opts )
1316 return function ()
1417 local node_cur = lib .get_node_at_cursor ()
1518 local first_node_line = core .get_nodes_starting_line ()
1619 local nodes_by_line = utils .get_nodes_by_line (core .get_explorer ().nodes , first_node_line )
1720 local iter_start , iter_end , iter_step , cur , first , nex
1821
19- if where == " next" then
22+ if opts . where == " next" then
2023 iter_start , iter_end , iter_step = first_node_line , # nodes_by_line , 1
21- elseif where == " prev" then
24+ elseif opts . where == " prev" then
2225 iter_start , iter_end , iter_step = # nodes_by_line , first_node_line , - 1
2326 end
2427
2528 for line = iter_start , iter_end , iter_step do
2629 local node = nodes_by_line [line ]
2730 local valid = false
2831
29- if what == " git" then
32+ if opts . what == " git" then
3033 valid = explorer_node .get_git_status (node ) ~= nil
31- elseif what == " diag" then
34+ elseif opts . what == " diag" then
3235 valid = node .diag_status ~= nil
33- elseif what == " opened" then
36+ elseif opts . what == " opened" then
3437 valid = vim .fn .bufloaded (node .absolute_path ) ~= 0
3538 end
3639
0 commit comments