From 1660ca5c51224805c55ed661a285651af11279df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=A5=A0?= Date: Thu, 16 Jan 2025 16:56:57 +0800 Subject: [PATCH] fix 'bug: custom vendor configuration is broken (#1089)' (#1090) Assigning M.vendors to an empty table {} at line 267 causes the metatable set for M at line 340 to lose its effect. As a result, accessing M.vendors does not retrieve the correct vendors from the configuration but instead always accesses an empty table. --- lua/avante/config.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 5418eb7..122a209 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -263,9 +263,6 @@ M.diff = {} ---@type Provider[] M.providers = {} ----@type AvanteProvider[] -M.vendors = {} - ---@param opts? avante.Config function M.setup(opts) vim.validate({ opts = { opts, "table", true } }) @@ -357,7 +354,7 @@ M.has_provider = function(provider) return M._options[provider] ~= nil or M.vend M.get_provider = function(provider) if M._options[provider] ~= nil then return vim.deepcopy(M._options[provider], true) - elseif M.vendors[provider] ~= nil then + elseif M.vendors and M.vendors[provider] ~= nil then return vim.deepcopy(M.vendors[provider], true) else error("Failed to find provider: " .. provider, 2)