mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
feat: use vim.uv
everywhere instead of vim.loop
This commit is contained in:
parent
7f333f006f
commit
3a87c08cda
11 changed files with 23 additions and 23 deletions
|
@ -22,7 +22,7 @@ M.spec = { "lsp", { ".git", "lua" }, "cwd" }
|
|||
M.detectors = {}
|
||||
|
||||
function M.detectors.cwd()
|
||||
return { vim.loop.cwd() }
|
||||
return { vim.uv.cwd() }
|
||||
end
|
||||
|
||||
function M.detectors.lsp(buf)
|
||||
|
@ -48,7 +48,7 @@ end
|
|||
---@param patterns string[]|string
|
||||
function M.detectors.pattern(buf, patterns)
|
||||
patterns = type(patterns) == "string" and { patterns } or patterns
|
||||
local path = M.bufpath(buf) or vim.loop.cwd()
|
||||
local path = M.bufpath(buf) or vim.uv.cwd()
|
||||
local pattern = vim.fs.find(patterns, { path = path, upward = true })[1]
|
||||
return pattern and { vim.fs.dirname(pattern) } or {}
|
||||
end
|
||||
|
@ -58,14 +58,14 @@ function M.bufpath(buf)
|
|||
end
|
||||
|
||||
function M.cwd()
|
||||
return M.realpath(vim.loop.cwd()) or ""
|
||||
return M.realpath(vim.uv.cwd()) or ""
|
||||
end
|
||||
|
||||
function M.realpath(path)
|
||||
if path == "" or path == nil then
|
||||
return nil
|
||||
end
|
||||
path = vim.loop.fs_realpath(path) or path
|
||||
path = vim.uv.fs_realpath(path) or path
|
||||
return Util.norm(path)
|
||||
end
|
||||
|
||||
|
@ -133,7 +133,7 @@ function M.info()
|
|||
lines[#lines + 1] = "vim.g.root_spec = " .. vim.inspect(spec)
|
||||
lines[#lines + 1] = "```"
|
||||
require("lazyvim.util").info(lines, { title = "LazyVim Roots" })
|
||||
return roots[1] and roots[1].paths[1] or vim.loop.cwd()
|
||||
return roots[1] and roots[1].paths[1] or vim.uv.cwd()
|
||||
end
|
||||
|
||||
---@type table<number, string>
|
||||
|
@ -164,7 +164,7 @@ function M.get(opts)
|
|||
local ret = M.cache[buf]
|
||||
if not ret then
|
||||
local roots = M.detect({ all = false })
|
||||
ret = roots[1] and roots[1].paths[1] or vim.loop.cwd()
|
||||
ret = roots[1] and roots[1].paths[1] or vim.uv.cwd()
|
||||
M.cache[buf] = ret
|
||||
end
|
||||
if opts and opts.normalize then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue