chore: resolve undefined-field
This commit is contained in:
@@ -12,8 +12,8 @@ local MAX_DEPTH = 100
|
|||||||
---Return the status of the node or nil if no status, depending on the type of
|
---Return the status of the node or nil if no status, depending on the type of
|
||||||
---status.
|
---status.
|
||||||
---@param node Node to inspect
|
---@param node Node to inspect
|
||||||
---@param what string type of status
|
---@param what string? type of status
|
||||||
---@param skip_gitignored boolean default false
|
---@param skip_gitignored boolean? default false
|
||||||
---@return boolean
|
---@return boolean
|
||||||
local function status_is_valid(node, what, skip_gitignored)
|
local function status_is_valid(node, what, skip_gitignored)
|
||||||
if what == "git" then
|
if what == "git" then
|
||||||
@@ -31,9 +31,9 @@ end
|
|||||||
|
|
||||||
---Move to the next node that has a valid status. If none found, don't move.
|
---Move to the next node that has a valid status. If none found, don't move.
|
||||||
---@param explorer Explorer
|
---@param explorer Explorer
|
||||||
---@param where string where to move (forwards or backwards)
|
---@param where string? where to move (forwards or backwards)
|
||||||
---@param what string type of status
|
---@param what string? type of status
|
||||||
---@param skip_gitignored boolean default false
|
---@param skip_gitignored boolean? default false
|
||||||
local function move(explorer, where, what, skip_gitignored)
|
local function move(explorer, where, what, skip_gitignored)
|
||||||
local first_node_line = core.get_nodes_starting_line()
|
local first_node_line = core.get_nodes_starting_line()
|
||||||
local nodes_by_line = utils.get_nodes_by_line(explorer.nodes, first_node_line)
|
local nodes_by_line = utils.get_nodes_by_line(explorer.nodes, first_node_line)
|
||||||
@@ -84,8 +84,8 @@ end
|
|||||||
|
|
||||||
--- Move to the next node recursively.
|
--- Move to the next node recursively.
|
||||||
---@param explorer Explorer
|
---@param explorer Explorer
|
||||||
---@param what string type of status
|
---@param what string? type of status
|
||||||
---@param skip_gitignored boolean default false
|
---@param skip_gitignored? boolean default false
|
||||||
local function move_next_recursive(explorer, what, skip_gitignored)
|
local function move_next_recursive(explorer, what, skip_gitignored)
|
||||||
-- If the current node:
|
-- If the current node:
|
||||||
-- * is a directory
|
-- * is a directory
|
||||||
@@ -150,8 +150,8 @@ end
|
|||||||
--- 4.5) Save the current node and start back from 4.1.
|
--- 4.5) Save the current node and start back from 4.1.
|
||||||
---
|
---
|
||||||
---@param explorer Explorer
|
---@param explorer Explorer
|
||||||
---@param what string type of status
|
---@param what string? type of status
|
||||||
---@param skip_gitignored boolean default false
|
---@param skip_gitignored boolean? default false
|
||||||
local function move_prev_recursive(explorer, what, skip_gitignored)
|
local function move_prev_recursive(explorer, what, skip_gitignored)
|
||||||
local node_init, node_cur
|
local node_init, node_cur
|
||||||
|
|
||||||
@@ -210,8 +210,10 @@ local function move_prev_recursive(explorer, what, skip_gitignored)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@class NavigationItemOpts
|
---@class NavigationItemOpts
|
||||||
---@field where string
|
---@field where string?
|
||||||
---@field what string
|
---@field what string?
|
||||||
|
---@field skip_gitignored boolean?
|
||||||
|
---@field recurse boolean?
|
||||||
|
|
||||||
---@param opts NavigationItemOpts
|
---@param opts NavigationItemOpts
|
||||||
---@return fun()
|
---@return fun()
|
||||||
@@ -223,26 +225,21 @@ function M.fn(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local recurse = false
|
local recurse = false
|
||||||
local skip_gitignored = false
|
|
||||||
|
|
||||||
-- recurse only valid for git and diag moves.
|
-- recurse only valid for git and diag moves.
|
||||||
if (opts.what == "git" or opts.what == "diag") and opts.recurse ~= nil then
|
if (opts.what == "git" or opts.what == "diag") and opts.recurse ~= nil then
|
||||||
recurse = opts.recurse
|
recurse = opts.recurse
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts.skip_gitignored ~= nil then
|
|
||||||
skip_gitignored = opts.skip_gitignored
|
|
||||||
end
|
|
||||||
|
|
||||||
if not recurse then
|
if not recurse then
|
||||||
move(explorer, opts.where, opts.what, skip_gitignored)
|
move(explorer, opts.where, opts.what, opts.skip_gitignored)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts.where == "next" then
|
if opts.where == "next" then
|
||||||
move_next_recursive(explorer, opts.what, skip_gitignored)
|
move_next_recursive(explorer, opts.what, opts.skip_gitignored)
|
||||||
elseif opts.where == "prev" then
|
elseif opts.where == "prev" then
|
||||||
move_prev_recursive(explorer, opts.what, skip_gitignored)
|
move_prev_recursive(explorer, opts.what, opts.skip_gitignored)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user