From ec31f348b2e6a8502fafa3dcb7379818bbe8584d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leiser=20Fern=C3=A1ndez=20Gallo?= Date: Thu, 10 Oct 2024 14:04:37 +0200 Subject: [PATCH] fix(save): schedule save within a loop (#560) --- lua/avante/path.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/avante/path.lua b/lua/avante/path.lua index c3136eb..f089c4a 100644 --- a/lua/avante/path.lua +++ b/lua/avante/path.lua @@ -49,10 +49,10 @@ end -- Saves the chat history for the given buffer. ---@param bufnr integer ---@param history table -History.save = function(bufnr, history) +History.save = vim.schedule_wrap(function(bufnr, history) local history_file = History.get(bufnr) history_file:write(vim.json.encode(history), "w") -end +end) P.history = History