fix checkhealth to run outside lazy (#1401)
This commit is contained in:
@@ -6,19 +6,31 @@ local Config = require("avante.config")
|
|||||||
function M.check()
|
function M.check()
|
||||||
H.start("avante.nvim")
|
H.start("avante.nvim")
|
||||||
|
|
||||||
-- Required dependencies
|
-- Required dependencies with their module names
|
||||||
local required_plugins = {
|
local required_plugins = {
|
||||||
["nvim-treesitter"] = "nvim-treesitter/nvim-treesitter",
|
["nvim-treesitter"] = {
|
||||||
["dressing.nvim"] = "stevearc/dressing.nvim",
|
path = "nvim-treesitter/nvim-treesitter",
|
||||||
["plenary.nvim"] = "nvim-lua/plenary.nvim",
|
module = "nvim-treesitter",
|
||||||
["nui.nvim"] = "MunifTanjim/nui.nvim",
|
},
|
||||||
|
["dressing.nvim"] = {
|
||||||
|
path = "stevearc/dressing.nvim",
|
||||||
|
module = "dressing",
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
path = "nvim-lua/plenary.nvim",
|
||||||
|
module = "plenary",
|
||||||
|
},
|
||||||
|
["nui.nvim"] = {
|
||||||
|
path = "MunifTanjim/nui.nvim",
|
||||||
|
module = "nui",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for plugin_name, plugin_path in pairs(required_plugins) do
|
for name, plugin in pairs(required_plugins) do
|
||||||
if Utils.has(plugin_name) then
|
if Utils.has(name) or Utils.has(plugin.module) then
|
||||||
H.ok(string.format("Found required plugin: %s", plugin_path))
|
H.ok(string.format("Found required plugin: %s", plugin.path))
|
||||||
else
|
else
|
||||||
H.error(string.format("Missing required plugin: %s", plugin_path))
|
H.error(string.format("Missing required plugin: %s", plugin.path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -31,7 +43,7 @@ function M.check()
|
|||||||
|
|
||||||
-- Check Copilot if configured
|
-- Check Copilot if configured
|
||||||
if Config.providers and Config.providers == "copilot" then
|
if Config.providers and Config.providers == "copilot" then
|
||||||
if Utils.has("copilot.lua") or Utils.has("copilot.vim") then
|
if Utils.has("copilot.lua") or Utils.has("copilot.vim") or Utils.has("copilot") then
|
||||||
H.ok("Found Copilot plugin")
|
H.ok("Found Copilot plugin")
|
||||||
else
|
else
|
||||||
H.error("Copilot provider is configured but neither copilot.lua nor copilot.vim is installed")
|
H.error("Copilot provider is configured but neither copilot.lua nor copilot.vim is installed")
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ setmetatable(M, {
|
|||||||
function M.has(plugin)
|
function M.has(plugin)
|
||||||
local ok, LazyConfig = pcall(require, "lazy.core.config")
|
local ok, LazyConfig = pcall(require, "lazy.core.config")
|
||||||
if ok then return LazyConfig.plugins[plugin] ~= nil end
|
if ok then return LazyConfig.plugins[plugin] ~= nil end
|
||||||
return package.loaded[plugin] ~= nil
|
|
||||||
|
local res, _ = pcall(require, plugin)
|
||||||
|
return res ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.is_win() return jit.os:find("Windows") ~= nil end
|
function M.is_win() return jit.os:find("Windows") ~= nil end
|
||||||
|
|||||||
Reference in New Issue
Block a user