Skip to content

Commit 32f05ee

Browse files
committed
debug: add logging to diagnose mini.files selection issue
1 parent 07fa185 commit 32f05ee

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lua/claudecode/integrations.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ function M._get_mini_files_selection()
279279

280280
local bufnr = vim.api.nvim_get_current_buf()
281281

282+
-- Debug logging
283+
local logger = require("claudecode.logger")
284+
logger.debug("integrations", "mini.files selection called")
285+
logger.debug("integrations", " bufnr: " .. tostring(bufnr))
286+
logger.debug("integrations", " mode: " .. tostring(vim.fn.mode()))
287+
282288
-- Check if we're in visual mode for multi-selection
283289
local mode = vim.fn.mode()
284290
if mode == "V" or mode == "v" or mode == "\22" then
@@ -305,16 +311,25 @@ function M._get_mini_files_selection()
305311
end
306312
end
307313

314+
logger.debug("integrations", "Visual mode files found: " .. #files)
315+
for i, file in ipairs(files) do
316+
logger.debug("integrations", " file " .. i .. ": " .. file)
317+
end
318+
308319
if #files > 0 then
309320
return files, nil
310321
end
311322
else
323+
logger.debug("integrations", "Normal mode: getting file under cursor")
312324
-- Normal mode: get file under cursor
313325
local entry_ok, entry = pcall(mini_files.get_fs_entry, bufnr)
314326
if not entry_ok or not entry then
327+
logger.debug("integrations", "Failed to get entry from mini.files")
315328
return {}, "Failed to get entry from mini.files"
316329
end
317330

331+
logger.debug("integrations", "Entry found: " .. tostring(entry.path))
332+
318333
if entry.path and entry.path ~= "" then
319334
-- Extract real filesystem path from mini.files buffer path
320335
local real_path = entry.path
@@ -323,15 +338,20 @@ function M._get_mini_files_selection()
323338
real_path = real_path:gsub("^minifiles://[^/]*/", "")
324339
end
325340

341+
logger.debug("integrations", "Real path: " .. tostring(real_path))
342+
326343
-- Validate that the path exists
327344
if vim.fn.filereadable(real_path) == 1 or vim.fn.isdirectory(real_path) == 1 then
345+
logger.debug("integrations", "Path is valid, returning: " .. real_path)
328346
return { real_path }, nil
329347
else
348+
logger.debug("integrations", "Path is invalid: " .. real_path)
330349
return {}, "Invalid file or directory path: " .. real_path
331350
end
332351
end
333352
end
334353

354+
logger.debug("integrations", "No file found under cursor")
335355
return {}, "No file found under cursor"
336356
end
337357

0 commit comments

Comments
 (0)