From 32ca1ed38efb99491c1d8066f9d32bac094f6fb6 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 1 May 2025 02:50:01 +0800 Subject: [PATCH] fix: set default auto suggestions provider to nil (#1951) --- lua/avante/config.lua | 2 +- lua/avante/providers/init.lua | 8 +++++--- lua/avante/suggestion.lua | 2 +- lua/avante/utils/environment.lua | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 4f2392b..a6821e5 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -26,7 +26,7 @@ M._defaults = { -- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive, -- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048 -- Of course, you can reduce the request frequency by increasing `suggestion.debounce`. - auto_suggestions_provider = "claude", + auto_suggestions_provider = nil, cursor_applying_provider = nil, memory_summary_provider = nil, ---@alias Tokenizer "tiktoken" | "hf" diff --git a/lua/avante/providers/init.lua b/lua/avante/providers/init.lua index f017895..7d0e3d5 100644 --- a/lua/avante/providers/init.lua +++ b/lua/avante/providers/init.lua @@ -207,12 +207,14 @@ function M.setup() ---@type AvanteProviderFunctor | AvanteBedrockProviderFunctor local provider = M[Config.provider] - local auto_suggestions_provider = M[Config.auto_suggestions_provider] E.setup({ provider = provider }) - if auto_suggestions_provider and auto_suggestions_provider ~= provider then - E.setup({ provider = auto_suggestions_provider }) + if Config.auto_suggestions_provider then + local auto_suggestions_provider = M[Config.auto_suggestions_provider] + if auto_suggestions_provider and auto_suggestions_provider ~= provider then + E.setup({ provider = auto_suggestions_provider }) + end end if Config.memory_summary_provider then diff --git a/lua/avante/suggestion.lua b/lua/avante/suggestion.lua index 34990d1..8a9da64 100644 --- a/lua/avante/suggestion.lua +++ b/lua/avante/suggestion.lua @@ -72,7 +72,7 @@ function Suggestion:suggest() local full_response = "" - local provider = Providers[Config.auto_suggestions_provider] + local provider = Providers[Config.auto_suggestions_provider or Config.provider] ---@type AvanteLLMMessage[] local history_messages = { diff --git a/lua/avante/utils/environment.lua b/lua/avante/utils/environment.lua index 15080e3..764e635 100644 --- a/lua/avante/utils/environment.lua +++ b/lua/avante/utils/environment.lua @@ -36,7 +36,6 @@ function M.parse(key_name, override) Utils.debug("running command:", cmd) local exit_codes = { 0 } local ok, job_or_err = pcall(vim.system, cmd, { text = true }, function(result) - Utils.debug("command result:", result) local code = result.code local stderr = result.stderr or "" local stdout = result.stdout and vim.split(result.stdout, "\n") or {}