Skip to content

Commit 4372e6a

Browse files
committed
chore: resolve undefined-field
1 parent 46725da commit 4372e6a

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

lua/nvim-tree/git/init.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ local Iterator = require("nvim-tree.iterators.node-iterator")
88
local DirectoryNode = require("nvim-tree.node.directory")
99

1010
---Git xy short-format statuses for a single node
11-
---@class (exact) GitStatus
11+
---@class (exact) GitNodeStatus
1212
---@field file string?
1313
---@field dir table<"direct" | "indirect", string[]>?
1414

@@ -135,9 +135,9 @@ function M.reload_project(toplevel, path, callback)
135135
}
136136

137137
if callback then
138-
---@param statuses GitPathXY
139-
runner_opts.callback = function(statuses)
140-
reload_git_project(toplevel, path, project, statuses)
138+
---@param path_xy GitPathXY
139+
runner_opts.callback = function(path_xy)
140+
reload_git_project(toplevel, path, project, path_xy)
141141
callback()
142142
end
143143
GitRunner:run(runner_opts)

lua/nvim-tree/git/runner.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ local Class = require("nvim-tree.class")
1010
---@field list_untracked boolean
1111
---@field list_ignored boolean
1212
---@field timeout integer
13-
---@field callback fun(statuses: GitPathXY)?
13+
---@field callback fun(path_xy: GitPathXY)?
1414

1515
---@class (exact) GitRunner: Class
1616
---@field private opts GitRunnerOpts
17-
---@field private statuses GitPathXY
17+
---@field private path_xy GitPathXY
1818
---@field private rc integer? -- -1 indicates timeout
1919
local GitRunner = Class:new()
2020

@@ -34,7 +34,7 @@ function GitRunner:parse_status_output(status, path)
3434
path = path:gsub("/", "\\")
3535
end
3636
if #status > 0 and #path > 0 then
37-
self.statuses[utils.path_remove_trailing(utils.path_join({ self.opts.toplevel, path }))] = status
37+
self.path_xy[utils.path_remove_trailing(utils.path_join({ self.opts.toplevel, path }))] = status
3838
end
3939
end
4040

@@ -218,7 +218,7 @@ function GitRunner:execute()
218218

219219
self:finalise()
220220

221-
self.opts.callback(self.statuses)
221+
self.opts.callback(self.path_xy)
222222
end)
223223
else
224224
-- sync, maybe call back
@@ -230,9 +230,9 @@ function GitRunner:execute()
230230
self:finalise()
231231

232232
if self.opts.callback then
233-
self.opts.callback(self.statuses)
233+
self.opts.callback(self.path_xy)
234234
else
235-
return self.statuses
235+
return self.path_xy
236236
end
237237
end
238238
end
@@ -244,7 +244,7 @@ function GitRunner:run(opts)
244244
---@type GitRunner
245245
local runner = {
246246
opts = opts,
247-
statuses = {},
247+
path_xy = {},
248248
}
249249
runner = GitRunner:new(runner)
250250

lua/nvim-tree/git/utils.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,49 +130,49 @@ function M.project_files_to_project_dirs(project_files, cwd)
130130
return project_dirs
131131
end
132132

133-
---Git file status for an absolute path with optional fallback
133+
---Git file status for an absolute path
134134
---@param parent_ignored boolean
135135
---@param status table?
136136
---@param path string
137-
---@param path_fallback string?
138-
---@return GitStatus
137+
---@param path_fallback string? alternative file path when no other file status
138+
---@return GitNodeStatus
139139
function M.git_status_file(parent_ignored, status, path, path_fallback)
140-
---@type GitStatus
141-
local st = {}
140+
---@type GitNodeStatus
141+
local ns = {}
142142

143143
if parent_ignored then
144-
st.file = "!!"
144+
ns.file = "!!"
145145
elseif status and status.files then
146-
st.file = status.files[path] or status.files[path_fallback]
146+
ns.file = status.files[path] or status.files[path_fallback]
147147
end
148148

149-
return st
149+
return ns
150150
end
151151

152-
---Git file and directory status for an absolute path with optional file fallback
152+
---Git file and directory status for an absolute path
153153
---@param parent_ignored boolean
154154
---@param status table?
155155
---@param path string
156-
---@param path_file string? alternative file path when no other file status
157-
---@return GitStatus?
158-
function M.git_status_dir(parent_ignored, status, path, path_file)
159-
---@type GitStatus?
160-
local st
156+
---@param path_fallback string? alternative file path when no other file status
157+
---@return GitNodeStatus?
158+
function M.git_status_dir(parent_ignored, status, path, path_fallback)
159+
---@type GitNodeStatus?
160+
local ns
161161

162162
if parent_ignored then
163-
st = {}
164-
st.file = "!!"
163+
ns = {}
164+
ns.file = "!!"
165165
elseif status then
166-
st = {}
167-
st.file = status.files and (status.files[path] or status.files[path_file])
166+
ns = {}
167+
ns.file = status.files and (status.files[path] or status.files[path_fallback])
168168
if status.dirs then
169-
st.dir = {}
170-
st.dir.direct = status.dirs.direct and status.dirs.direct[path]
171-
st.dir.indirect = status.dirs.indirect and status.dirs.indirect[path]
169+
ns.dir = {}
170+
ns.dir.direct = status.dirs.direct and status.dirs.direct[path]
171+
ns.dir.indirect = status.dirs.indirect and status.dirs.indirect[path]
172172
end
173173
end
174174

175-
return st
175+
return ns
176176
end
177177

178178
function M.setup(opts)

lua/nvim-tree/node/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ local Class = require("nvim-tree.class")
88
---@field absolute_path string
99
---@field executable boolean
1010
---@field fs_stat uv.fs_stat.result?
11-
---@field git_status GitStatus?
11+
---@field git_status GitNodeStatus?
1212
---@field hidden boolean
1313
---@field name string
1414
---@field parent DirectoryNode?

0 commit comments

Comments
 (0)