From c4e26a87673190a5e6a1bf8a006ef3db6d2fc139 Mon Sep 17 00:00:00 2001 From: Aaron Pham Date: Sat, 17 Aug 2024 16:31:24 -0400 Subject: [PATCH] feat(experimental): add section for behaviour (#55) Signed-off-by: Aaron Pham --- lua/avante/config.lua | 3 +++ lua/avante/sidebar.lua | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 004d2e6..e2ca5c2 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -27,6 +27,9 @@ M.defaults = { temperature = 0, max_tokens = 4096, }, + behaviour = { + auto_apply_diff_after_generation = false, -- Whether to automatically apply diff after LLM response. + }, highlights = { ---@type AvanteConflictHighlights diff = { diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 3755b0c..2f9c303 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -659,16 +659,15 @@ function Sidebar:render() end ) - api.nvim_set_current_win(self.winid.result) - - -- Display notification - -- show_notification("Content generation complete!") - -- Save chat history table.insert(chat_history or {}, { timestamp = timestamp, requirement = user_input, response = full_response }) save_chat_history(self, chat_history) end ) + + if Config.behaviour.auto_apply_diff_after_generation then + apply() + end end local body = function()