chore: resolve undefined-field
This commit is contained in:
@@ -139,6 +139,19 @@ function DirectoryNode:refresh()
|
||||
end)
|
||||
end
|
||||
|
||||
---@param projects table
|
||||
function DirectoryNode:reload_node_status(projects)
|
||||
local toplevel = git.get_toplevel(self.absolute_path)
|
||||
local status = projects[toplevel] or {}
|
||||
for _, node in ipairs(self.nodes) do
|
||||
node:update_git_status(self:is_git_ignored(), status)
|
||||
local dir = node:as(DirectoryNode)
|
||||
if dir and #dir.nodes > 0 then
|
||||
dir:reload_node_status(projects)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If node is grouped, return the last node in the group. Otherwise, return the given node.
|
||||
---@return DirectoryNode
|
||||
function DirectoryNode:last_group_node()
|
||||
|
||||
@@ -21,32 +21,18 @@ local Node = Class:new()
|
||||
function Node:destroy()
|
||||
end
|
||||
|
||||
--luacheck: push ignore 212
|
||||
---Update the GitStatus of the node
|
||||
---Abstract
|
||||
---@param parent_ignored boolean
|
||||
---@param status table?
|
||||
function Node:update_git_status(parent_ignored, status) ---@diagnostic disable-line: unused-local
|
||||
---TODO find a way to declare abstract methods
|
||||
function Node:update_git_status(parent_ignored, status)
|
||||
self:nop(parent_ignored, status)
|
||||
end
|
||||
|
||||
--luacheck: pop
|
||||
|
||||
---@return GitStatus?
|
||||
function Node:get_git_status()
|
||||
end
|
||||
|
||||
---@param projects table
|
||||
function Node:reload_node_status(projects)
|
||||
local toplevel = git.get_toplevel(self.absolute_path)
|
||||
local status = projects[toplevel] or {}
|
||||
for _, node in ipairs(self.nodes) do
|
||||
node:update_git_status(self:is_git_ignored(), status)
|
||||
if node.nodes and #node.nodes > 0 then
|
||||
node:reload_node_status(projects)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
function Node:is_git_ignored()
|
||||
return self.git_status ~= nil and self.git_status.file == "!!"
|
||||
|
||||
Reference in New Issue
Block a user