From 63832ae0c3267824d5d0172204ddfd784e66a648 Mon Sep 17 00:00:00 2001 From: Dominik Polakovics Date: Sat, 14 Dec 2024 13:04:29 +0100 Subject: [PATCH] feat: better debug logging for ignored files --- lua/chatgpt_nvim/context.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/chatgpt_nvim/context.lua b/lua/chatgpt_nvim/context.lua index 9983227..35e7e02 100644 --- a/lua/chatgpt_nvim/context.lua +++ b/lua/chatgpt_nvim/context.lua @@ -31,8 +31,12 @@ local function load_gitignore_patterns(root) end local function should_ignore_file(file, ignore_patterns) + local conf = config.load() for _, pattern in ipairs(ignore_patterns) do if file:find(pattern, 1, true) then + if conf.debug then + vim.api.nvim_out_write("[chatgpt_nvim:context] Ignoring file/dir: " .. file .. " (matched pattern: " .. pattern .. ")\n") + end return true end end @@ -80,10 +84,6 @@ local function scandir(dir, ignore_patterns, files) elseif ent.type == "directory" and ent.name ~= ".git" then scandir(fullpath, ignore_patterns, files) end - else - if conf.debug then - vim.api.nvim_out_write("[chatgpt_nvim:context] Ignoring file/dir: " .. fullpath .. "\n") - end end end end