From 3abdb69fa29b3f9b0c79c5c54494fc9cb7214760 Mon Sep 17 00:00:00 2001 From: Christopher Brewin Date: Thu, 14 Nov 2024 19:30:00 +1000 Subject: [PATCH] feat(repo-map): configurable negate patterns (#844) --- lua/avante/config.lua | 1 + lua/avante/repo_map.lua | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 8c9dd7e..21d4d91 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -212,6 +212,7 @@ M.defaults = { --- @class AvanteRepoMapConfig repo_map = { ignore_patterns = { "%.git", "%.worktree", "__pycache__", "node_modules" }, -- ignore files matching these + negate_patterns = {}, -- negate ignore files matching these. }, } diff --git a/lua/avante/repo_map.lua b/lua/avante/repo_map.lua index 6c2f303..bd8a029 100644 --- a/lua/avante/repo_map.lua +++ b/lua/avante/repo_map.lua @@ -48,8 +48,9 @@ end function RepoMap._build_repo_map(project_root, file_ext) local output = {} local gitignore_path = project_root .. "/.gitignore" - local gitignore_patterns, negate_patterns = Utils.parse_gitignore(gitignore_path) + local gitignore_patterns, gitignore_negate_patterns = Utils.parse_gitignore(gitignore_path) local ignore_patterns = vim.list_extend(gitignore_patterns, Config.repo_map.ignore_patterns) + local negate_patterns = vim.list_extend(gitignore_negate_patterns, Config.repo_map.negate_patterns) local filepaths = Utils.scan_directory(project_root, ignore_patterns, negate_patterns) vim.iter(filepaths):each(function(filepath)