@@ -12,8 +12,8 @@ local MAX_DEPTH = 100
1212--- Return the status of the node or nil if no status, depending on the type of
1313--- status.
1414--- @param node Node to inspect
15- --- @param what string type of status
16- --- @param skip_gitignored boolean default false
15+ --- @param what string ? type of status
16+ --- @param skip_gitignored boolean ? default false
1717--- @return boolean
1818local function status_is_valid (node , what , skip_gitignored )
1919 if what == " git" then
3131
3232--- Move to the next node that has a valid status. If none found, don't move.
3333--- @param explorer Explorer
34- --- @param where string where to move (forwards or backwards )
35- --- @param what string type of status
36- --- @param skip_gitignored boolean default false
34+ --- @param where string ? where to move (forwards or backwards )
35+ --- @param what string ? type of status
36+ --- @param skip_gitignored boolean ? default false
3737local function move (explorer , where , what , skip_gitignored )
3838 local first_node_line = core .get_nodes_starting_line ()
3939 local nodes_by_line = utils .get_nodes_by_line (explorer .nodes , first_node_line )
8484
8585--- Move to the next node recursively.
8686--- @param explorer Explorer
87- --- @param what string type of status
88- --- @param skip_gitignored boolean default false
87+ --- @param what string ? type of status
88+ --- @param skip_gitignored ? boolean default false
8989local function move_next_recursive (explorer , what , skip_gitignored )
9090 -- If the current node:
9191 -- * is a directory
150150--- 4.5) Save the current node and start back from 4.1.
151151---
152152--- @param explorer Explorer
153- --- @param what string type of status
154- --- @param skip_gitignored boolean default false
153+ --- @param what string ? type of status
154+ --- @param skip_gitignored boolean ? default false
155155local function move_prev_recursive (explorer , what , skip_gitignored )
156156 local node_init , node_cur
157157
@@ -210,8 +210,10 @@ local function move_prev_recursive(explorer, what, skip_gitignored)
210210end
211211
212212--- @class NavigationItemOpts
213- --- @field where string
214- --- @field what string
213+ --- @field where string ?
214+ --- @field what string ?
215+ --- @field skip_gitignored boolean ?
216+ --- @field recurse boolean ?
215217
216218--- @param opts NavigationItemOpts
217219--- @return fun ()
@@ -223,26 +225,21 @@ function M.fn(opts)
223225 end
224226
225227 local recurse = false
226- local skip_gitignored = false
227228
228229 -- recurse only valid for git and diag moves.
229230 if (opts .what == " git" or opts .what == " diag" ) and opts .recurse ~= nil then
230231 recurse = opts .recurse
231232 end
232233
233- if opts .skip_gitignored ~= nil then
234- skip_gitignored = opts .skip_gitignored
235- end
236-
237234 if not recurse then
238- move (explorer , opts .where , opts .what , skip_gitignored )
235+ move (explorer , opts .where , opts .what , opts . skip_gitignored )
239236 return
240237 end
241238
242239 if opts .where == " next" then
243- move_next_recursive (explorer , opts .what , skip_gitignored )
240+ move_next_recursive (explorer , opts .what , opts . skip_gitignored )
244241 elseif opts .where == " prev" then
245- move_prev_recursive (explorer , opts .what , skip_gitignored )
242+ move_prev_recursive (explorer , opts .what , opts . skip_gitignored )
246243 end
247244 end
248245end
0 commit comments