Skip to content

Commit 4fcf2ad

Browse files
committed
refactor(avante): move avante loading logic
1 parent c3bfc56 commit 4fcf2ad

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lua/mcphub/extensions/avante/init.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ end
197197
---@param config MCPHub.Extensions.AvanteConfig
198198
function M.setup(config)
199199
if config.make_slash_commands then
200+
--Avoid checking for avante if the extension is not enabled
201+
local ok, _ = pcall(require, "avante")
202+
if not ok then
203+
return
204+
end
200205
require("mcphub.extensions.avante.slash_commands").setup()
201206
end
202207
end

lua/mcphub/extensions/init.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ local M = {}
2525
function M.setup(config)
2626
local avante_config = config.avante or {}
2727
if avante_config.enabled then
28-
local ok, _ = pcall(require, "avante")
29-
if ok then
30-
local avante_ext = require("mcphub.extensions.avante")
31-
avante_ext.setup(avante_config)
32-
end
28+
require("mcphub.extensions.avante").setup(avante_config)
3329
end
3430
end
3531

0 commit comments

Comments
 (0)