fix(warning): taken into account silent_warning (fixes #385) (#388)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham 2024-08-30 02:08:59 -04:00 committed by GitHub
parent b7127b33c6
commit ea73816665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
local Config = require("avante.config")
local Utils = require("avante.utils") local Utils = require("avante.utils")
---@class avante.ApiToggle ---@class avante.ApiToggle
@ -17,7 +18,7 @@ return setmetatable({}, {
---@class AvailableApi: ApiCaller ---@class AvailableApi: ApiCaller
---@field api? boolean ---@field api? boolean
local has = module[k] local has = module[k]
if type(has) ~= "table" or not has.api then if type(has) ~= "table" or not has.api and not Config.silent_warning then
Utils.warn(k .. " is not a valid avante's API method", { once = true }) Utils.warn(k .. " is not a valid avante's API method", { once = true })
return return
end end

View File

@ -233,7 +233,7 @@ M = setmetatable(M, {
M.support_paste_image = function() M.support_paste_image = function()
local supported = Utils.has("img-clip.nvim") or Utils.has("img-clip") local supported = Utils.has("img-clip.nvim") or Utils.has("img-clip")
if not supported then if not supported and not M.options.silent_warning then
Utils.warn("img-clip.nvim is not installed. Pasting image will be disabled.", { once = true }) Utils.warn("img-clip.nvim is not installed. Pasting image will be disabled.", { once = true })
end end
return supported return supported