Skip to content

Commit 031ce63

Browse files
committed
wip
1 parent 8aa4848 commit 031ce63

File tree

2 files changed

+11
-11
lines changed
  • lua/codecompanion/interactions/chat

2 files changed

+11
-11
lines changed

lua/codecompanion/interactions/chat/helpers/diff.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ function M.create(bufnr_or_path, diff_id, opts)
314314

315315
log:debug("[builtin::helpers::diff::create] Called - diff_id=%s", tostring(diff_id))
316316

317-
if approvals:is_approved(opts.chat_bufnr) or not config.display.diff.enabled then
317+
if approvals:is_approved(opts.chat_bufnr, { tool_name = opts.tool_name }) or not config.display.diff.enabled then
318318
return nil
319319
end
320320

lua/codecompanion/interactions/chat/tools/builtin/insert_edit_into_file/init.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,16 @@ local function edit_buffer(bufnr, chat_bufnr, action, output_handler, opts)
889889
local final_lines = vim.split(dry_run_result.final_content, "\n", { plain = true })
890890
api.nvim_buf_set_lines(bufnr, 0, -1, false, final_lines)
891891

892+
local success = success_response(fmt("Edited `%s` buffer%s", display_name, extract_explanation(action)))
893+
894+
if approvals:is_approved(chat_bufnr, { tool_name = "insert_edit_into_file" }) then
895+
api.nvim_buf_call(bufnr, function()
896+
vim.cmd("silent write")
897+
end)
898+
899+
return output_handler(success)
900+
end
901+
892902
local should_diff = diff.create(bufnr, diff_id, {
893903
chat_bufnr = chat_bufnr,
894904
original_content = original_content,
@@ -904,16 +914,6 @@ local function edit_buffer(bufnr, chat_bufnr, action, output_handler, opts)
904914
ui_utils.scroll_to_line(bufnr, start_line)
905915
end
906916

907-
local success = success_response(fmt("Edited `%s` buffer%s", display_name, extract_explanation(action)))
908-
909-
if approvals:is_approved(chat_bufnr, { tool_name = "insert_edit_into_file" }) then
910-
api.nvim_buf_call(bufnr, function()
911-
vim.cmd("silent write")
912-
end)
913-
914-
return output_handler(success)
915-
end
916-
917917
if should_diff and opts.require_confirmation_after then
918918
return handle_user_decision({
919919
diff_id = diff_id,

0 commit comments

Comments
 (0)