aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_editor.lua8
-rw-r--r--runtime/lua/vim/_watch.lua6
-rw-r--r--runtime/lua/vim/filetype/options.lua2
-rw-r--r--runtime/lua/vim/fs.lua20
-rw-r--r--runtime/lua/vim/loader.lua4
-rw-r--r--runtime/lua/vim/lsp.lua2
-rw-r--r--runtime/lua/vim/lsp/health.lua2
-rw-r--r--runtime/lua/vim/lsp/log.lua4
-rw-r--r--runtime/lua/vim/lsp/rpc.lua4
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua2
-rw-r--r--runtime/lua/vim/lsp/util.lua2
-rw-r--r--runtime/lua/vim/secure.lua6
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua4
13 files changed, 35 insertions, 31 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index b26def5958..7b946a55e4 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -42,6 +42,10 @@ for k, v in pairs({
vim._submodules[k] = v
end
+-- Remove at Nvim 1.0
+---@deprecated
+vim.loop = vim.uv
+
-- There are things which have special rules in vim._init_packages
-- for legacy reasons (uri) or for performance (_inspector).
-- most new things should go into a submodule namespace ( vim.foobar.do_thing() )
@@ -159,7 +163,7 @@ do
--- - 3: ends the paste (exactly once)
---@returns boolean # false if client should cancel the paste.
function vim.paste(lines, phase)
- local now = vim.loop.now()
+ local now = vim.uv.now()
local is_first_chunk = phase < 2
local is_last_chunk = phase == -1 or phase == 3
if is_first_chunk then -- Reset flags.
@@ -483,7 +487,7 @@ end
---@return table timer luv timer object
function vim.defer_fn(fn, timeout)
vim.validate({ fn = { fn, 'c', true } })
- local timer = vim.loop.new_timer()
+ local timer = vim.uv.new_timer()
timer:start(
timeout,
0,
diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua
index dbffd726a2..3bd8a56f6e 100644
--- a/runtime/lua/vim/_watch.lua
+++ b/runtime/lua/vim/_watch.lua
@@ -46,7 +46,7 @@ function M.watch(path, opts, callback)
path = vim.fs.normalize(path)
local uvflags = opts and opts.uvflags or {}
- local handle, new_err = vim.loop.new_fs_event()
+ local handle, new_err = vim.uv.new_fs_event()
assert(not new_err, new_err)
local _, start_err = handle:start(path, uvflags, function(err, filename, events)
assert(not err, err)
@@ -57,7 +57,7 @@ function M.watch(path, opts, callback)
end
local change_type = events.change and M.FileChangeType.Changed or 0
if events.rename then
- local _, staterr, staterrname = vim.loop.fs_stat(fullpath)
+ local _, staterr, staterrname = vim.uv.fs_stat(fullpath)
if staterrname == 'ENOENT' then
change_type = M.FileChangeType.Deleted
else
@@ -99,7 +99,7 @@ local function poll_internal(path, opts, callback, watches)
}
if not watches.handle then
- local poll, new_err = vim.loop.new_fs_poll()
+ local poll, new_err = vim.uv.new_fs_poll()
assert(not new_err, new_err)
watches.handle = poll
local _, start_err = poll:start(
diff --git a/runtime/lua/vim/filetype/options.lua b/runtime/lua/vim/filetype/options.lua
index a093c249f7..2a28b5a8e3 100644
--- a/runtime/lua/vim/filetype/options.lua
+++ b/runtime/lua/vim/filetype/options.lua
@@ -34,7 +34,7 @@ local ft_option_cache = {} ---@type table<string,table<string,any>>
--- @param path string
--- @return integer
local function hash(path)
- local mtime0 = vim.loop.fs_stat(path).mtime
+ local mtime0 = vim.uv.fs_stat(path).mtime
return mtime0.sec * 1000000000 + mtime0.nsec
end
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
index 864ba495f1..5e63fb6237 100644
--- a/runtime/lua/vim/fs.lua
+++ b/runtime/lua/vim/fs.lua
@@ -1,6 +1,6 @@
local M = {}
-local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
+local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
--- Iterate over all the parents of the given file or directory.
---
@@ -106,12 +106,12 @@ function M.dir(path, opts)
})
if not opts.depth or opts.depth == 1 then
- local fs = vim.loop.fs_scandir(M.normalize(path))
+ local fs = vim.uv.fs_scandir(M.normalize(path))
return function()
if not fs then
return
end
- return vim.loop.fs_scandir_next(fs)
+ return vim.uv.fs_scandir_next(fs)
end
end
@@ -121,9 +121,9 @@ function M.dir(path, opts)
while #dirs > 0 do
local dir0, level = unpack(table.remove(dirs, 1))
local dir = level == 1 and dir0 or M.joinpath(path, dir0)
- local fs = vim.loop.fs_scandir(M.normalize(dir))
+ local fs = vim.uv.fs_scandir(M.normalize(dir))
while fs do
- local name, t = vim.loop.fs_scandir_next(fs)
+ local name, t = vim.uv.fs_scandir_next(fs)
if not name then
break
end
@@ -158,7 +158,7 @@ end
--- -- location of Cargo.toml from the current buffer's path
--- local cargo = vim.fs.find('Cargo.toml', {
--- upward = true,
---- stop = vim.loop.os_homedir(),
+--- stop = vim.uv.os_homedir(),
--- path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
--- })
---
@@ -212,7 +212,7 @@ function M.find(names, opts)
names = type(names) == 'string' and { names } or names
- local path = opts.path or vim.loop.cwd()
+ local path = opts.path or vim.uv.cwd()
local stop = opts.stop
local limit = opts.limit or 1
@@ -244,7 +244,7 @@ function M.find(names, opts)
local t = {}
for _, name in ipairs(names) do
local f = M.joinpath(p, name)
- local stat = vim.loop.fs_stat(f)
+ local stat = vim.uv.fs_stat(f)
if stat and (not opts.type or opts.type == stat.type) then
t[#t + 1] = f
end
@@ -337,7 +337,7 @@ function M.normalize(path, opts)
})
if path:sub(1, 1) == '~' then
- local home = vim.loop.os_homedir() or '~'
+ local home = vim.uv.os_homedir() or '~'
if home:sub(-1) == '\\' or home:sub(-1) == '/' then
home = home:sub(1, -2)
end
@@ -345,7 +345,7 @@ function M.normalize(path, opts)
end
if opts.expand_env == nil or opts.expand_env then
- path = path:gsub('%$([%w_]+)', vim.loop.os_getenv)
+ path = path:gsub('%$([%w_]+)', vim.uv.os_getenv)
end
path = path:gsub('\\', '/'):gsub('/+', '/')
diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua
index 66627fe4e7..9024bdb231 100644
--- a/runtime/lua/vim/loader.lua
+++ b/runtime/lua/vim/loader.lua
@@ -1,4 +1,4 @@
-local uv = vim.loop
+local uv = vim.uv
--- @type (fun(modename: string): fun()|string)[]
local loaders = package.loaders
@@ -465,7 +465,7 @@ end
--- @private
function Loader.track(stat, f)
return function(...)
- local start = vim.loop.hrtime()
+ local start = vim.uv.hrtime()
local r = { f(...) }
Loader._stats[stat] = Loader._stats[stat] or { total = 0, time = 0 }
Loader._stats[stat].total = Loader._stats[stat].total + 1
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index baf8b5c1a8..5f7a95ae14 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -10,7 +10,7 @@ local semantic_tokens = require('vim.lsp.semantic_tokens')
local api = vim.api
local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_exec_autocmds =
api.nvim_err_writeln, api.nvim_buf_get_lines, api.nvim_command, api.nvim_exec_autocmds
-local uv = vim.loop
+local uv = vim.uv
local tbl_isempty, tbl_extend = vim.tbl_isempty, vim.tbl_extend
local validate = vim.validate
local if_nil = vim.F.if_nil
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index 6ca468393e..8817bb71de 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -22,7 +22,7 @@ function M.check()
local log_path = vim.lsp.get_log_path()
report_info(string.format('Log path: %s', log_path))
- local log_file = vim.loop.fs_stat(log_path)
+ local log_file = vim.uv.fs_stat(log_path)
local log_size = log_file and log_file.size or 0
local report_fn = (log_size / 1000000 > 100 and report_warn or report_info)
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index 3d5bc06c3f..07d0500797 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -31,7 +31,7 @@ do
end
end
- local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/'
+ local path_sep = vim.uv.os_uname().version:match('Windows') and '\\' or '/'
---@private
local function path_join(...)
return table.concat(vim.tbl_flatten({ ... }), path_sep)
@@ -68,7 +68,7 @@ do
return false
end
- local log_info = vim.loop.fs_stat(logfilename)
+ local log_info = vim.uv.fs_stat(logfilename)
if log_info and log_info.size > 1e9 then
local warn_msg = string.format(
'LSP client log is large (%d MB): %s',
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index af3190c9bd..5f48effebf 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -1,4 +1,4 @@
-local uv = vim.loop
+local uv = vim.uv
local log = require('vim.lsp.log')
local protocol = require('vim.lsp.protocol')
local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedule_wrap
@@ -691,7 +691,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
})
---@private
- --- Callback for |vim.loop.spawn()| Closes all streams and runs the `on_exit` dispatcher.
+ --- Callback for |vim.uv.spawn()| Closes all streams and runs the `on_exit` dispatcher.
---@param code (integer) Exit code
---@param signal (integer) Signal that was used to terminate (if any)
local function onexit(code, signal)
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index 376cac19a7..191cc7b400 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -2,7 +2,7 @@ local api = vim.api
local bit = require('bit')
local handlers = require('vim.lsp.handlers')
local util = require('vim.lsp.util')
-local uv = vim.loop
+local uv = vim.uv
--- @class STTokenRange
--- @field line integer line number 0-based
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 9fffc845b1..53f8dba814 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -4,7 +4,7 @@ local validate = vim.validate
local api = vim.api
local list_extend = vim.list_extend
local highlight = require('vim.highlight')
-local uv = vim.loop
+local uv = vim.uv
local npcall = vim.F.npcall
local split = vim.split
diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua
index 443b152273..1a04e11231 100644
--- a/runtime/lua/vim/secure.lua
+++ b/runtime/lua/vim/secure.lua
@@ -51,7 +51,7 @@ end
--- trusted, or nil otherwise.
function M.read(path)
vim.validate({ path = { path, 's' } })
- local fullpath = vim.loop.fs_realpath(vim.fs.normalize(path))
+ local fullpath = vim.uv.fs_realpath(vim.fs.normalize(path))
if not fullpath then
return nil
end
@@ -149,13 +149,13 @@ function M.trust(opts)
local fullpath
if path then
- fullpath = vim.loop.fs_realpath(vim.fs.normalize(path))
+ fullpath = vim.uv.fs_realpath(vim.fs.normalize(path))
elseif bufnr then
local bufname = vim.api.nvim_buf_get_name(bufnr)
if bufname == '' then
return false, 'buffer is not associated with a file'
end
- fullpath = vim.loop.fs_realpath(vim.fs.normalize(bufname))
+ fullpath = vim.uv.fs_realpath(vim.fs.normalize(bufname))
else
error('one of "path" or "bufnr" is required')
end
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 244d88f3e0..cabfa8ccc0 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -170,11 +170,11 @@ end
---@param f fun(): R1, R2, R2
---@return integer, R1, R2, R3
local function tcall(f, ...)
- local start = vim.loop.hrtime()
+ local start = vim.uv.hrtime()
---@diagnostic disable-next-line
local r = { f(...) }
--- @type number
- local duration = (vim.loop.hrtime() - start) / 1000000
+ local duration = (vim.uv.hrtime() - start) / 1000000
return duration, unpack(r)
end