From c356fc7ce16c3a3c1e09a8b890e589d7a0e7007a Mon Sep 17 00:00:00 2001 From: guanghechen <42513619+guanghechen@users.noreply.github.com> Date: Wed, 18 Jun 2025 13:35:37 +0800 Subject: [PATCH] fix: when initialize the avante, dont mark the current buffer as selected if it's a directory path (#2254) --- lua/avante/sidebar.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 4902459..c58fa60 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -1436,7 +1436,9 @@ function Sidebar:initialize() Utils.debug("Sidebar:initialize adding buffer to file selector", buf_path) self.file_selector:reset() - self.file_selector:add_selected_file(filepath) + + local stat = vim.uv.fs_stat(filepath) + if stat == nil or stat.type == "file" then self.file_selector:add_selected_file(filepath) end self:reload_chat_history()