@@ -12,8 +12,8 @@ local MAX_DEPTH = 100
12
12
--- Return the status of the node or nil if no status, depending on the type of
13
13
--- status.
14
14
--- @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
17
17
--- @return boolean
18
18
local function status_is_valid (node , what , skip_gitignored )
19
19
if what == " git" then
31
31
32
32
--- Move to the next node that has a valid status. If none found, don't move.
33
33
--- @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
37
37
local function move (explorer , where , what , skip_gitignored )
38
38
local first_node_line = core .get_nodes_starting_line ()
39
39
local nodes_by_line = utils .get_nodes_by_line (explorer .nodes , first_node_line )
84
84
85
85
--- Move to the next node recursively.
86
86
--- @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
89
89
local function move_next_recursive (explorer , what , skip_gitignored )
90
90
-- If the current node:
91
91
-- * is a directory
150
150
--- 4.5) Save the current node and start back from 4.1.
151
151
---
152
152
--- @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
155
155
local function move_prev_recursive (explorer , what , skip_gitignored )
156
156
local node_init , node_cur
157
157
@@ -210,8 +210,10 @@ local function move_prev_recursive(explorer, what, skip_gitignored)
210
210
end
211
211
212
212
--- @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 ?
215
217
216
218
--- @param opts NavigationItemOpts
217
219
--- @return fun ()
@@ -223,26 +225,21 @@ function M.fn(opts)
223
225
end
224
226
225
227
local recurse = false
226
- local skip_gitignored = false
227
228
228
229
-- recurse only valid for git and diag moves.
229
230
if (opts .what == " git" or opts .what == " diag" ) and opts .recurse ~= nil then
230
231
recurse = opts .recurse
231
232
end
232
233
233
- if opts .skip_gitignored ~= nil then
234
- skip_gitignored = opts .skip_gitignored
235
- end
236
-
237
234
if not recurse then
238
- move (explorer , opts .where , opts .what , skip_gitignored )
235
+ move (explorer , opts .where , opts .what , opts . skip_gitignored )
239
236
return
240
237
end
241
238
242
239
if opts .where == " next" then
243
- move_next_recursive (explorer , opts .what , skip_gitignored )
240
+ move_next_recursive (explorer , opts .what , opts . skip_gitignored )
244
241
elseif opts .where == " prev" then
245
- move_prev_recursive (explorer , opts .what , skip_gitignored )
242
+ move_prev_recursive (explorer , opts .what , opts . skip_gitignored )
246
243
end
247
244
end
248
245
end
0 commit comments