From bbfc315eed3ddea3f02d6991a0cb1a8ca895c733 Mon Sep 17 00:00:00 2001 From: Aaron Pham Date: Sun, 20 Oct 2024 22:45:53 -0400 Subject: [PATCH] fix: conflict mapping with refresh and repomap (#740) --- lua/avante/config.lua | 2 +- lua/avante/repo_map.lua | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index f5ac69c..d82adce 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -150,7 +150,7 @@ Respect and use existing conventions, libraries, etc that are already present in debug = "ad", hint = "ah", suggestion = "as", - repomap = "ar", + repomap = "aR", }, sidebar = { apply_all = "A", diff --git a/lua/avante/repo_map.lua b/lua/avante/repo_map.lua index adca68f..93dfc92 100644 --- a/lua/avante/repo_map.lua +++ b/lua/avante/repo_map.lua @@ -38,12 +38,8 @@ function RepoMap.get_filetype(filepath) -- https://github.com/neovim/neovim/issues/27265 if not filetype then local ext = fn.fnamemodify(filepath, ":e") - if ext == "tsx" then - filetype = "typescriptreact" - end - if ext == "ts" then - filetype = "typescript" - end + if ext == "tsx" then filetype = "typescriptreact" end + if ext == "ts" then filetype = "typescript" end end return filetype end @@ -60,8 +56,9 @@ function RepoMap._build_repo_map(project_root, file_ext) return end local filetype = RepoMap.get_ts_lang(filepath) - local definitions = filetype and - repo_map_lib.stringify_definitions(filetype, Utils.file.read_content(filepath) or "") or "" + local definitions = filetype + and repo_map_lib.stringify_definitions(filetype, Utils.file.read_content(filepath) or "") + or "" if definitions == "" then return end table.insert(output, { path = Utils.relative_path(filepath),