Skip to content

Commit

Permalink
chore: resolve undefined-field
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-courtis committed Oct 28, 2024
1 parent c8b6848 commit caed010
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lua/nvim-tree/explorer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ end
---@param nodes_by_path Node[]
---@param node_ignored boolean
---@param project GitProject?
---@return fun(node: Node): table
---@return fun(node: Node): Node
function Explorer:update_git_statuses(nodes_by_path, node_ignored, project)
return function(node)
if nodes_by_path[node.absolute_path] then
Expand Down
22 changes: 11 additions & 11 deletions lua/nvim-tree/git/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ end

---Git file status for an absolute path
---@param parent_ignored boolean
---@param status table?
---@param project GitProject?
---@param path string
---@param path_fallback string? alternative file path when no other file status
---@return GitNodeStatus
function M.git_status_file(parent_ignored, status, path, path_fallback)
function M.git_status_file(parent_ignored, project, path, path_fallback)
---@type GitNodeStatus
local ns

if parent_ignored then
ns = {
file = "!!"
}
elseif status and status.files then
elseif project and project.files then
ns = {
file = status.files[path] or status.files[path_fallback]
file = project.files[path] or project.files[path_fallback]
}
else
ns = {}
Expand All @@ -157,24 +157,24 @@ end

---Git file and directory status for an absolute path
---@param parent_ignored boolean
---@param status table?
---@param project GitProject?
---@param path string
---@param path_fallback string? alternative file path when no other file status
---@return GitNodeStatus?
function M.git_status_dir(parent_ignored, status, path, path_fallback)
function M.git_status_dir(parent_ignored, project, path, path_fallback)
---@type GitNodeStatus?
local ns

if parent_ignored then
ns = {
file = "!!"
}
elseif status then
elseif project then
ns = {
file = status.files and (status.files[path] or status.files[path_fallback]),
dir = status.dirs and {
direct = status.dirs.direct and status.dirs.direct[path],
indirect = status.dirs.indirect and status.dirs.indirect[path],
file = project.files and (project.files[path] or project.files[path_fallback]),
dir = project.dirs and {
direct = project.dirs.direct and project.dirs.direct[path],
indirect = project.dirs.indirect and project.dirs.indirect[path],
},
}
end
Expand Down

0 comments on commit caed010

Please sign in to comment.