mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-27 19:24:13 +00:00
fix(rocks): better errors / warnings when something goes wrong with luarocks
This commit is contained in:
parent
9005e8ede7
commit
7d3f69104f
11 changed files with 336 additions and 141 deletions
|
@ -464,10 +464,8 @@ function M.add_to_rtp(plugin)
|
|||
local rtp = vim.api.nvim_get_runtime_file("", true)
|
||||
local idx_dir, idx_after
|
||||
|
||||
local is_win = jit.os:find("Windows")
|
||||
|
||||
for i, path in ipairs(rtp) do
|
||||
if is_win then
|
||||
if Util.is_win then
|
||||
path = Util.norm(path)
|
||||
end
|
||||
if path == Config.me then
|
||||
|
|
|
@ -33,9 +33,7 @@ function M:load_pkgs()
|
|||
if not Config.options.pkg.enabled then
|
||||
return
|
||||
end
|
||||
local have_rockspec = false
|
||||
for _, pkg in ipairs(Pkg.get()) do
|
||||
have_rockspec = have_rockspec or pkg.source == "rockspec"
|
||||
local meta, fragment = self:add(pkg.spec)
|
||||
if meta and fragment then
|
||||
meta._.pkg = pkg
|
||||
|
@ -48,12 +46,6 @@ function M:load_pkgs()
|
|||
self.pkgs[pkg.dir] = fragment.id
|
||||
end
|
||||
end
|
||||
if have_rockspec then
|
||||
local hererocks = Pkg.hererocks()
|
||||
if hererocks then
|
||||
self:add(hererocks)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Remove a plugin and all its fragments.
|
||||
|
|
|
@ -335,6 +335,20 @@ function M.load()
|
|||
lazy._.loaded = {}
|
||||
end
|
||||
|
||||
-- add hererocks when enabled and needed
|
||||
if Config.options.rocks.hererocks then
|
||||
for _, plugin in pairs(Config.spec.plugins) do
|
||||
if plugin.build == "rockspec" then
|
||||
Config.spec.meta:add({
|
||||
"luarocks/hererocks",
|
||||
build = "rockspec",
|
||||
lazy = true,
|
||||
})
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local existing = Config.plugins
|
||||
Config.plugins = Config.spec.plugins
|
||||
-- copy state. This wont do anything during startup
|
||||
|
|
|
@ -5,6 +5,7 @@ local M = {}
|
|||
|
||||
---@type LazyProfile[]
|
||||
M._profiles = { { name = "lazy" } }
|
||||
M.is_win = jit.os:find("Windows")
|
||||
|
||||
---@param data (string|{[string]:string})?
|
||||
---@param time number?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue