Skip to content

Commit

Permalink
fix: setting adapters for default configs
Browse files Browse the repository at this point in the history
  • Loading branch information
olimorris committed Apr 24, 2024
1 parent 6be6388 commit 2401db0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/codecompanion/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ local defaults = {
M.setup = function(opts)
M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {})

-- Handle adapter updates
-- Handle custom adapter config
if opts and opts.adapters then
for name, adapter in pairs(opts.adapters) do
if M.options.adapters[name] then
Expand All @@ -79,6 +79,12 @@ M.setup = function(opts)
end
end
end
else
for _, adapter in pairs(M.options.strategies) do
if type(M.options.adapters[adapter]) == "string" then
M.options.adapters[adapter] = require("codecompanion.adapters").use(adapter)
end
end
end

M.INFO_NS = vim.api.nvim_create_namespace("CodeCompanion-info")
Expand Down

0 comments on commit 2401db0

Please sign in to comment.