feat: silence debug msg (#636)
This commit is contained in:
parent
0d90c047ef
commit
22243bc316
@ -73,9 +73,9 @@ M.build = function(opts)
|
||||
local output = stdout
|
||||
if #output == 0 then
|
||||
table.insert(output, "")
|
||||
Utils.debug(output)
|
||||
Utils.debug("build output:", output)
|
||||
else
|
||||
Utils.debug(stderr)
|
||||
Utils.debug("build error:", stderr)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -84,8 +84,7 @@ M.stream = function(opts)
|
||||
:filter(function(k) return k ~= "" end)
|
||||
:totable()
|
||||
|
||||
Utils.debug(user_prompts)
|
||||
-- print(user_prompts[1])
|
||||
Utils.debug("user prompts:", user_prompts)
|
||||
|
||||
---@type AvantePromptOptions
|
||||
local code_opts = {
|
||||
@ -102,7 +101,7 @@ M.stream = function(opts)
|
||||
---@type AvanteCurlOutput
|
||||
local spec = Provider.parse_curl_args(Provider, code_opts)
|
||||
|
||||
Utils.debug(spec)
|
||||
Utils.debug("curl spec:", spec)
|
||||
|
||||
---@param line string
|
||||
local function parse_stream_data(line)
|
||||
@ -182,7 +181,7 @@ M.stream = function(opts)
|
||||
-- Error: cannot resume dead coroutine
|
||||
if active_job then
|
||||
xpcall(function() active_job:shutdown() end, function(err) return err end)
|
||||
Utils.debug("LLM request cancelled", { title = "Avante" })
|
||||
Utils.debug("LLM request cancelled")
|
||||
active_job = nil
|
||||
end
|
||||
end,
|
||||
|
@ -81,7 +81,7 @@ function Suggestion:suggest()
|
||||
Utils.error("Error while suggesting: " .. vim.inspect(err), { once = true, title = "Avante" })
|
||||
return
|
||||
end
|
||||
Utils.debug("full_response: " .. vim.inspect(full_response))
|
||||
Utils.debug("full_response:", full_response)
|
||||
vim.schedule(function()
|
||||
local cursor_row, cursor_col = Utils.get_cursor_pos()
|
||||
if cursor_row ~= doc.position.row or cursor_col ~= doc.position.col then return end
|
||||
|
@ -123,7 +123,7 @@ M.safe_keymap_set = function(mode, lhs, rhs, opts)
|
||||
|
||||
ok, H = pcall(require, "lazy.core.handler")
|
||||
if not ok then
|
||||
M.debug("lazy.nvim is not available. Avante will use vim.keymap.set", { once = true })
|
||||
M.debug("lazy.nvim is not available. Avante will use vim.keymap.set")
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
return
|
||||
end
|
||||
@ -324,18 +324,21 @@ function M.warn(msg, opts)
|
||||
M.notify(msg, opts)
|
||||
end
|
||||
|
||||
---@param msg string|table
|
||||
---@param opts? LazyNotifyOpts
|
||||
function M.debug(msg, opts)
|
||||
function M.debug(...)
|
||||
if not require("avante.config").options.debug then return end
|
||||
opts = opts or {}
|
||||
if opts.title then opts.title = "avante.nvim: " .. opts.title end
|
||||
if type(msg) == "string" then
|
||||
M.notify(msg, opts)
|
||||
else
|
||||
opts.lang = "lua"
|
||||
M.notify(vim.inspect(msg), opts)
|
||||
|
||||
local args = { ... }
|
||||
if #args == 0 then return end
|
||||
local timestamp = os.date("%Y-%m-%d %H:%M:%S")
|
||||
local formated_args = { "[" .. timestamp .. "] [AVANTE] [DEBUG]" }
|
||||
for _, arg in ipairs(args) do
|
||||
if type(arg) == "string" then
|
||||
table.insert(formated_args, arg)
|
||||
else
|
||||
table.insert(formated_args, vim.inspect(arg))
|
||||
end
|
||||
end
|
||||
print(unpack(formated_args))
|
||||
end
|
||||
|
||||
function M.tbl_indexof(tbl, value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user