Skip to content

Commit 2c0b647

Browse files
committed
feat(#3310): minimum neovim version 0.10
1 parent 35be95a commit 2c0b647

File tree

19 files changed

+65
-65
lines changed

19 files changed

+65
-65
lines changed

lua/nvim-tree/actions/finders/find-file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function M.fn(path)
1919
end
2020

2121
-- always match against the real path
22-
local path_real = vim.loop.fs_realpath(path)
22+
local path_real = vim.uv.fs_realpath(path)
2323
if not path_real then
2424
return
2525
end

lua/nvim-tree/actions/finders/search-node.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ local function search(search_dir, input_path)
2525

2626
local filter_status = explorer.filters:prepare()
2727

28-
handle, _ = vim.loop.fs_scandir(dir)
28+
handle, _ = vim.uv.fs_scandir(dir)
2929
if not handle then
3030
return
3131
end
3232

33-
realpath, _ = vim.loop.fs_realpath(dir)
33+
realpath, _ = vim.uv.fs_realpath(dir)
3434
if not realpath or vim.tbl_contains(realpaths_searched, realpath) then
3535
return
3636
end
3737
table.insert(realpaths_searched, realpath)
3838

39-
name, _ = vim.loop.fs_scandir_next(handle)
39+
name, _ = vim.uv.fs_scandir_next(handle)
4040
while name do
4141
path = dir .. "/" .. name
4242

4343
---@type uv.fs_stat.result|nil
44-
stat, _ = vim.loop.fs_stat(path)
44+
stat, _ = vim.uv.fs_stat(path)
4545
if not stat then
4646
break
4747
end
@@ -59,7 +59,7 @@ local function search(search_dir, input_path)
5959
end
6060
end
6161

62-
name, _ = vim.loop.fs_scandir_next(handle)
62+
name, _ = vim.uv.fs_scandir_next(handle)
6363
end
6464
end
6565

lua/nvim-tree/actions/fs/clipboard.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848
---@return boolean
4949
---@return string|nil
5050
local function do_copy(source, destination)
51-
local source_stats, err = vim.loop.fs_stat(source)
51+
local source_stats, err = vim.uv.fs_stat(source)
5252

5353
if not source_stats then
5454
log.line("copy_paste", "do_copy fs_stat '%s' failed '%s'", source, err)
@@ -64,15 +64,15 @@ local function do_copy(source, destination)
6464

6565
if source_stats.type == "file" then
6666
local success
67-
success, err = vim.loop.fs_copyfile(source, destination)
67+
success, err = vim.uv.fs_copyfile(source, destination)
6868
if not success then
6969
log.line("copy_paste", "do_copy fs_copyfile failed '%s'", err)
7070
return false, err
7171
end
7272
return true
7373
elseif source_stats.type == "directory" then
7474
local handle
75-
handle, err = vim.loop.fs_scandir(source)
75+
handle, err = vim.uv.fs_scandir(source)
7676
if type(handle) == "string" then
7777
return false, handle
7878
elseif not handle then
@@ -81,14 +81,14 @@ local function do_copy(source, destination)
8181
end
8282

8383
local success
84-
success, err = vim.loop.fs_mkdir(destination, source_stats.mode)
84+
success, err = vim.uv.fs_mkdir(destination, source_stats.mode)
8585
if not success then
8686
log.line("copy_paste", "do_copy fs_mkdir '%s' failed '%s'", destination, err)
8787
return false, err
8888
end
8989

9090
while true do
91-
local name, _ = vim.loop.fs_scandir_next(handle)
91+
local name, _ = vim.uv.fs_scandir_next(handle)
9292
if not name then
9393
break
9494
end
@@ -228,7 +228,7 @@ function Clipboard:resolve_conflicts(conflict, destination, action, action_fn)
228228
self:finish_paste(action)
229229
return
230230
end
231-
if vim.loop.fs_stat(new_dest) then
231+
if vim.uv.fs_stat(new_dest) then
232232
self:resolve_conflicts({ { node = conflict[1].node, dest = new_dest } }, destination, action, action_fn)
233233
else
234234
do_paste_one(source, new_dest, action, action_fn)
@@ -285,7 +285,7 @@ function Clipboard:resolve_conflicts(conflict, destination, action, action_fn)
285285
local extension = vim.fn.fnamemodify(item.node.name, ":e")
286286
local new_name = extension ~= "" and (basename .. suffix .. "." .. extension) or (item.node.name .. suffix)
287287
local new_dest = utils.path_join({ destination, new_name })
288-
local stats = vim.loop.fs_stat(new_dest)
288+
local stats = vim.uv.fs_stat(new_dest)
289289
if stats then
290290
table.insert(still_conflict, { node = item.node, dest = new_dest })
291291
else
@@ -324,7 +324,7 @@ function Clipboard:do_paste(node, action, action_fn)
324324
end
325325

326326
local destination = node.absolute_path
327-
local stats, err, err_name = vim.loop.fs_stat(destination)
327+
local stats, err, err_name = vim.uv.fs_stat(destination)
328328
if not stats and err_name ~= "ENOENT" then
329329
log.line("copy_paste", "do_paste fs_stat '%s' failed '%s'", destination, err)
330330
notify.error("Could not " .. action .. " " .. notify.render_path(destination) .. " - " .. (err or "???"))
@@ -340,7 +340,7 @@ function Clipboard:do_paste(node, action, action_fn)
340340
local conflict = {}
341341
for _, _node in ipairs(clip) do
342342
local dest = utils.path_join({ destination, _node.name })
343-
local dest_stats = vim.loop.fs_stat(dest)
343+
local dest_stats = vim.uv.fs_stat(dest)
344344
if dest_stats then
345345
table.insert(conflict, { node = _node, dest = dest })
346346
else
@@ -374,7 +374,7 @@ local function do_cut(source, destination)
374374
end
375375

376376
events._dispatch_will_rename_node(source, destination)
377-
local success, errmsg = vim.loop.fs_rename(source, destination)
377+
local success, errmsg = vim.uv.fs_rename(source, destination)
378378
if not success then
379379
log.line("copy_paste", "do_cut fs_rename failed '%s'", errmsg)
380380
return false, errmsg

lua/nvim-tree/actions/fs/create-file.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ local M = {}
1313
---@param file string
1414
local function create_and_notify(file)
1515
events._dispatch_will_create_file(file)
16-
local ok, fd = pcall(vim.loop.fs_open, file, "w", 420)
16+
local ok, fd = pcall(vim.uv.fs_open, file, "w", 420)
1717
if not ok or type(fd) ~= "number" then
1818
notify.error("Couldn't create file " .. notify.render_path(file))
1919
return
2020
end
21-
vim.loop.fs_close(fd)
21+
vim.uv.fs_close(fd)
2222
events._dispatch_file_created(file)
2323
end
2424

@@ -84,7 +84,7 @@ function M.fn(node)
8484
if is_last_path_file and idx == num_nodes then
8585
create_and_notify(path_to_create)
8686
elseif not utils.file_exists(path_to_create) then
87-
local success = vim.loop.fs_mkdir(path_to_create, 493)
87+
local success = vim.uv.fs_mkdir(path_to_create, 493)
8888
if not success then
8989
notify.error("Could not create folder " .. notify.render_path(path_to_create))
9090
is_error = true

lua/nvim-tree/actions/fs/remove-file.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,26 @@ end
6262
---@param cwd string
6363
---@return boolean|nil
6464
local function remove_dir(cwd)
65-
local handle, err = vim.loop.fs_scandir(cwd)
65+
local handle, err = vim.uv.fs_scandir(cwd)
6666
if not handle then
6767
notify.error(err)
6868
return
6969
end
7070

7171
while true do
72-
local name, _ = vim.loop.fs_scandir_next(handle)
72+
local name, _ = vim.uv.fs_scandir_next(handle)
7373
if not name then
7474
break
7575
end
7676

7777
local new_cwd = utils.path_join({ cwd, name })
7878

7979
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
80-
local stat = vim.loop.fs_stat(new_cwd)
80+
local stat = vim.uv.fs_stat(new_cwd)
8181
-- TODO remove once 0.12 is the minimum neovim version
8282
-- path incorrectly specified as an integer, fixed upstream for neovim 0.12 https://github.com/neovim/neovim/pull/33872
8383
---@diagnostic disable-next-line: param-type-mismatch
84-
local lstat = vim.loop.fs_lstat(new_cwd)
84+
local lstat = vim.uv.fs_lstat(new_cwd)
8585

8686
local type = stat and stat.type or nil
8787
-- Checks if file is a link file to ensure deletion of the symlink instead of the file it points to
@@ -93,15 +93,15 @@ local function remove_dir(cwd)
9393
return false
9494
end
9595
else
96-
local success = vim.loop.fs_unlink(new_cwd)
96+
local success = vim.uv.fs_unlink(new_cwd)
9797
if not success then
9898
return false
9999
end
100100
clear_buffer(new_cwd)
101101
end
102102
end
103103

104-
return vim.loop.fs_rmdir(cwd)
104+
return vim.uv.fs_rmdir(cwd)
105105
end
106106

107107
--- Remove a node, notify errors, dispatch events
@@ -118,7 +118,7 @@ function M.remove(node)
118118
events._dispatch_folder_removed(node.absolute_path)
119119
else
120120
events._dispatch_will_remove_file(node.absolute_path)
121-
local success = vim.loop.fs_unlink(node.absolute_path)
121+
local success = vim.uv.fs_unlink(node.absolute_path)
122122
if not success then
123123
notify.error("Could not remove " .. notify_node)
124124
return false

lua/nvim-tree/actions/fs/rename-file.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ function M.rename(node, to)
7474

7575
if idx == num_nodes then
7676
events._dispatch_will_rename_node(node.absolute_path, to)
77-
local success, err = vim.loop.fs_rename(node.absolute_path, to)
77+
local success, err = vim.uv.fs_rename(node.absolute_path, to)
7878

7979
if not success then
8080
notify.warn(err_fmt(notify_from, notify_to, err))
8181
return
8282
end
8383
elseif not rename_file_exists(notify_from, path_to_create) then
84-
local success = vim.loop.fs_mkdir(path_to_create, 493)
84+
local success = vim.uv.fs_mkdir(path_to_create, 493)
8585
if not success then
8686
notify.error("Could not create folder " .. notify.render_path(path_to_create))
8787
is_error = true

lua/nvim-tree/autocmd.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function M.global()
3030
vim.api.nvim_create_autocmd("DirChanged", {
3131
group = augroup_id,
3232
callback = function()
33-
require("nvim-tree.actions.tree.change-dir").fn(vim.loop.cwd())
33+
require("nvim-tree.actions.tree.change-dir").fn(vim.uv.cwd())
3434
end,
3535
})
3636
end

lua/nvim-tree/core.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ function M.init(foldername)
2222
local err, path
2323

2424
if foldername then
25-
path, err = vim.loop.fs_realpath(foldername)
25+
path, err = vim.uv.fs_realpath(foldername)
2626
else
27-
path, err = vim.loop.cwd()
27+
path, err = vim.uv.cwd()
2828
end
2929
if path then
3030
TreeExplorer = require("nvim-tree.explorer")({ path = path })

lua/nvim-tree/explorer/filters.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function Filters:custom(path)
177177
end
178178

179179
-- filter custom regexes
180-
local relpath = utils.path_relative(path, vim.loop.cwd())
180+
local relpath = utils.path_relative(path, vim.uv.cwd())
181181
for pat, _ in pairs(self.ignore_list) do
182182
if vim.fn.match(relpath, pat) ~= -1 or vim.fn.match(basename, pat) ~= -1 then
183183
return true

lua/nvim-tree/explorer/init.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ local FILTER_REASON = require("nvim-tree.enum").FILTER_REASON
2727
local find_file = require("nvim-tree.actions.finders.find-file")
2828

2929
---@class (exact) Explorer: RootNode
30-
---@field uid_explorer number vim.loop.hrtime() at construction time
30+
---@field uid_explorer number vim.uv.hrtime() at construction time
3131
---@field opts table user options
3232
---@field augroup_id integer
3333
---@field current_tab integer
@@ -54,7 +54,7 @@ function Explorer:new(args)
5454
name = "..",
5555
})
5656

57-
self.uid_explorer = vim.loop.hrtime()
57+
self.uid_explorer = vim.uv.hrtime()
5858
self.augroup_id = vim.api.nvim_create_augroup("NvimTree_Explorer_" .. self.uid_explorer, {})
5959

6060
self.open = true
@@ -203,7 +203,7 @@ end
203203
---@return Node[]?
204204
function Explorer:reload(node, project)
205205
local cwd = node.link_to or node.absolute_path
206-
local handle = vim.loop.fs_scandir(cwd)
206+
local handle = vim.uv.fs_scandir(cwd)
207207
if not handle then
208208
return
209209
end
@@ -233,7 +233,7 @@ function Explorer:reload(node, project)
233233
})
234234

235235
while true do
236-
local name, _ = vim.loop.fs_scandir_next(handle)
236+
local name, _ = vim.uv.fs_scandir_next(handle)
237237
if not name then
238238
break
239239
end
@@ -243,7 +243,7 @@ function Explorer:reload(node, project)
243243
-- TODO remove once 0.12 is the minimum neovim version
244244
-- path incorrectly specified as an integer, fixed upstream for neovim 0.12 https://github.com/neovim/neovim/pull/33872
245245
---@diagnostic disable-next-line: param-type-mismatch
246-
local stat = vim.loop.fs_lstat(abs)
246+
local stat = vim.uv.fs_lstat(abs)
247247

248248
local filter_reason = self.filters:should_filter_as_reason(abs, stat, filter_status)
249249
if filter_reason == FILTER_REASON.none then
@@ -391,7 +391,7 @@ function Explorer:populate_children(handle, cwd, node, project, parent)
391391
})
392392

393393
while true do
394-
local name, _ = vim.loop.fs_scandir_next(handle)
394+
local name, _ = vim.uv.fs_scandir_next(handle)
395395
if not name then
396396
break
397397
end
@@ -404,7 +404,7 @@ function Explorer:populate_children(handle, cwd, node, project, parent)
404404
-- TODO remove once 0.12 is the minimum neovim version
405405
-- path incorrectly specified as an integer, fixed upstream for neovim 0.12 https://github.com/neovim/neovim/pull/33872
406406
---@diagnostic disable-next-line: param-type-mismatch
407-
local stat = vim.loop.fs_lstat(abs)
407+
local stat = vim.uv.fs_lstat(abs)
408408

409409
local filter_reason = parent.filters:should_filter_as_reason(abs, stat, filter_status)
410410
if filter_reason == FILTER_REASON.none and not nodes_by_path[abs] then
@@ -440,7 +440,7 @@ end
440440
---@return Node[]|nil
441441
function Explorer:explore(node, project, parent)
442442
local cwd = node.link_to or node.absolute_path
443-
local handle = vim.loop.fs_scandir(cwd)
443+
local handle = vim.uv.fs_scandir(cwd)
444444
if not handle then
445445
return
446446
end

0 commit comments

Comments
 (0)