Skip to content

Commit 4aba93b

Browse files
committed
chore: resolve undefined-field
1 parent 142cb30 commit 4aba93b

File tree

7 files changed

+38
-38
lines changed

7 files changed

+38
-38
lines changed

lua/nvim-tree/explorer/filters.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ local function custom(self, path)
178178
end
179179

180180
---Prepare arguments for should_filter. This is done prior to should_filter for efficiency reasons.
181-
---@param git_status table|nil optional results of git.load_project(...)
181+
---@param project GitProject? optional results of git.load_projects(...)
182182
---@return table
183183
--- git_status: reference
184184
--- bufinfo: empty unless no_buffer set: vim.fn.getbufinfo { buflisted = 1 }
185185
--- bookmarks: absolute paths to boolean
186-
function Filters:prepare(git_status)
186+
function Filters:prepare(project)
187187
local status = {
188-
git_status = git_status or {},
188+
git_status = project or {},
189189
bufinfo = {},
190190
bookmarks = {},
191191
}

lua/nvim-tree/explorer/init.lua

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ function Explorer:expand(node)
187187
end
188188

189189
---@param node DirectoryNode
190-
---@param git_status table|nil
190+
---@param project GitProject?
191191
---@return Node[]?
192-
function Explorer:reload(node, git_status)
192+
function Explorer:reload(node, project)
193193
local cwd = node.link_to or node.absolute_path
194194
local handle = vim.loop.fs_scandir(cwd)
195195
if not handle then
@@ -198,7 +198,7 @@ function Explorer:reload(node, git_status)
198198

199199
local profile = log.profile_start("reload %s", node.absolute_path)
200200

201-
local filter_status = self.filters:prepare(git_status)
201+
local filter_status = self.filters:prepare(project)
202202

203203
if node.group_next then
204204
node.nodes = { node.group_next }
@@ -268,7 +268,7 @@ function Explorer:reload(node, git_status)
268268
end
269269

270270
node.nodes = vim.tbl_map(
271-
self:update_status(nodes_by_path, node_ignored, git_status),
271+
self:update_git_statuses(nodes_by_path, node_ignored, project),
272272
vim.tbl_filter(function(n)
273273
if remain_childs[n.absolute_path] then
274274
return remain_childs[n.absolute_path]
@@ -282,7 +282,7 @@ function Explorer:reload(node, git_status)
282282
local single_child = node:single_child_directory()
283283
if config.renderer.group_empty and node.parent and single_child then
284284
node.group_next = single_child
285-
local ns = self:reload(single_child, git_status)
285+
local ns = self:reload(single_child, project)
286286
node.nodes = ns or {}
287287
log.profile_end(profile)
288288
return ns
@@ -331,19 +331,19 @@ end
331331
---@param node DirectoryNode
332332
function Explorer:_load(node)
333333
local cwd = node.link_to or node.absolute_path
334-
local git_status = git.load_project(cwd)
335-
self:explore(node, git_status, self)
334+
local project = git.load_project(cwd)
335+
self:explore(node, project, self)
336336
end
337337

338338
---@private
339339
---@param nodes_by_path Node[]
340340
---@param node_ignored boolean
341-
---@param status table|nil
341+
---@param project GitProject?
342342
---@return fun(node: Node): table
343-
function Explorer:update_status(nodes_by_path, node_ignored, status)
343+
function Explorer:update_git_statuses(nodes_by_path, node_ignored, project)
344344
return function(node)
345345
if nodes_by_path[node.absolute_path] then
346-
node:update_git_status(node_ignored, status)
346+
node:update_git_status(node_ignored, project)
347347
end
348348
return node
349349
end
@@ -353,13 +353,13 @@ end
353353
---@param handle uv.uv_fs_t
354354
---@param cwd string
355355
---@param node DirectoryNode
356-
---@param git_status table
356+
---@param project GitProject
357357
---@param parent Explorer
358-
function Explorer:populate_children(handle, cwd, node, git_status, parent)
358+
function Explorer:populate_children(handle, cwd, node, project, parent)
359359
local node_ignored = node:is_git_ignored()
360360
local nodes_by_path = utils.bool_record(node.nodes, "absolute_path")
361361

362-
local filter_status = parent.filters:prepare(git_status)
362+
local filter_status = parent.filters:prepare(project)
363363

364364
node.hidden_stats = vim.tbl_deep_extend("force", node.hidden_stats or {}, {
365365
git = 0,
@@ -388,7 +388,7 @@ function Explorer:populate_children(handle, cwd, node, git_status, parent)
388388
if child then
389389
table.insert(node.nodes, child)
390390
nodes_by_path[child.absolute_path] = true
391-
child:update_git_status(node_ignored, git_status)
391+
child:update_git_status(node_ignored, project)
392392
end
393393
else
394394
for reason, value in pairs(FILTER_REASON) do
@@ -405,10 +405,10 @@ end
405405

406406
---@private
407407
---@param node DirectoryNode
408-
---@param status table
408+
---@param project GitProject
409409
---@param parent Explorer
410410
---@return Node[]|nil
411-
function Explorer:explore(node, status, parent)
411+
function Explorer:explore(node, project, parent)
412412
local cwd = node.link_to or node.absolute_path
413413
local handle = vim.loop.fs_scandir(cwd)
414414
if not handle then
@@ -417,15 +417,15 @@ function Explorer:explore(node, status, parent)
417417

418418
local profile = log.profile_start("explore %s", node.absolute_path)
419419

420-
self:populate_children(handle, cwd, node, status, parent)
420+
self:populate_children(handle, cwd, node, project, parent)
421421

422422
local is_root = not node.parent
423423
local single_child = node:single_child_directory()
424424
if config.renderer.group_empty and not is_root and single_child then
425425
local child_cwd = single_child.link_to or single_child.absolute_path
426-
local child_status = git.load_project(child_cwd)
426+
local child_project = git.load_project(child_cwd)
427427
node.group_next = single_child
428-
local ns = self:explore(single_child, child_status, parent)
428+
local ns = self:explore(single_child, child_project, parent)
429429
node.nodes = ns or {}
430430

431431
log.profile_end(profile)
@@ -440,7 +440,7 @@ function Explorer:explore(node, status, parent)
440440
end
441441

442442
---@private
443-
---@param projects table
443+
---@param projects GitProject[]
444444
function Explorer:refresh_nodes(projects)
445445
Iterator.builder({ self })
446446
:applier(function(n)

lua/nvim-tree/node/directory-link.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ end
3838

3939
---Update the directory git_status of link target and the file status of the link itself
4040
---@param parent_ignored boolean
41-
---@param status table|nil
42-
function DirectoryLinkNode:update_git_status(parent_ignored, status)
43-
self.git_status = git_utils.git_status_dir(parent_ignored, status, self.link_to, self.absolute_path)
41+
---@param project GitProject?
42+
function DirectoryLinkNode:update_git_status(parent_ignored, project)
43+
self.git_status = git_utils.git_status_dir(parent_ignored, project, self.link_to, self.absolute_path)
4444
end
4545

4646
---Create a sanitized partial copy of a node, populating children recursively.

lua/nvim-tree/node/directory.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ end
6767

6868
---Update the git_status of the directory
6969
---@param parent_ignored boolean
70-
---@param status table|nil
71-
function DirectoryNode:update_git_status(parent_ignored, status)
72-
self.git_status = git_utils.git_status_dir(parent_ignored, status, self.absolute_path, nil)
70+
---@param project GitProject?
71+
function DirectoryNode:update_git_status(parent_ignored, project)
72+
self.git_status = git_utils.git_status_dir(parent_ignored, project, self.absolute_path, nil)
7373
end
7474

7575
---@return GitXY[]?

lua/nvim-tree/node/file-link.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ end
3434

3535
---Update the git_status of the target otherwise the link itself
3636
---@param parent_ignored boolean
37-
---@param status table|nil
38-
function FileLinkNode:update_git_status(parent_ignored, status)
39-
self.git_status = git_utils.git_status_file(parent_ignored, status, self.link_to, self.absolute_path)
37+
---@param project GitProject?
38+
function FileLinkNode:update_git_status(parent_ignored, project)
39+
self.git_status = git_utils.git_status_file(parent_ignored, project, self.link_to, self.absolute_path)
4040
end
4141

4242
---Create a sanitized partial copy of a node

lua/nvim-tree/node/file.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ end
4242

4343
---Update the GitStatus of the file
4444
---@param parent_ignored boolean
45-
---@param status table|nil
46-
function FileNode:update_git_status(parent_ignored, status)
47-
self.git_status = git_utils.git_status_file(parent_ignored, status, self.absolute_path, nil)
45+
---@param project GitProject?
46+
function FileNode:update_git_status(parent_ignored, project)
47+
self.git_status = git_utils.git_status_file(parent_ignored, project, self.absolute_path, nil)
4848
end
4949

5050
---@return GitXY[]?

lua/nvim-tree/node/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ end
2222
---Update the git_status of the node
2323
---Abstract
2424
---@param parent_ignored boolean
25-
---@param status table?
26-
function Node:update_git_status(parent_ignored, status)
27-
self:nop(parent_ignored, status)
25+
---@param project GitProject?
26+
function Node:update_git_status(parent_ignored, project)
27+
self:nop(parent_ignored, project)
2828
end
2929

3030
---Short-format statuses

0 commit comments

Comments
 (0)