@@ -284,25 +284,51 @@ function M._get_mini_files_selection()
284
284
-- Visual mode: get visual range
285
285
local visual_commands = require (" claudecode.visual_commands" )
286
286
local start_line , end_line = visual_commands .get_visual_range ()
287
+
288
+ -- Debug logging to see what range we got
289
+ local logger = require (" claudecode.logger" )
290
+ logger .debug (" integrations" , " mini.files visual mode detected:" )
291
+ logger .debug (" integrations" , " mode: " .. tostring (mode ))
292
+ logger .debug (" integrations" , " start_line: " .. tostring (start_line ))
293
+ logger .debug (" integrations" , " end_line: " .. tostring (end_line ))
287
294
288
295
-- Process each line in the visual selection
289
296
for line = start_line , end_line do
297
+ logger .debug (" integrations" , " processing line " .. tostring (line ))
290
298
local entry_ok , entry = pcall (mini_files .get_fs_entry , bufnr , line )
291
- if entry_ok and entry and entry .path and entry .path ~= " " then
292
- -- Extract real filesystem path from mini.files buffer path
293
- local real_path = entry .path
294
- -- Remove mini.files buffer protocol prefix if present
295
- if real_path :match (" ^minifiles://" ) then
296
- real_path = real_path :gsub (" ^minifiles://[^/]*/" , " " )
297
- end
299
+
300
+ if entry_ok and entry then
301
+ logger .debug (" integrations" , " entry found: " .. tostring (entry .path ))
302
+ if entry .path and entry .path ~= " " then
303
+ -- Extract real filesystem path from mini.files buffer path
304
+ local real_path = entry .path
305
+ -- Remove mini.files buffer protocol prefix if present
306
+ if real_path :match (" ^minifiles://" ) then
307
+ real_path = real_path :gsub (" ^minifiles://[^/]*/" , " " )
308
+ end
309
+
310
+ logger .debug (" integrations" , " real_path: " .. tostring (real_path ))
298
311
299
- -- Validate that the path exists
300
- if vim .fn .filereadable (real_path ) == 1 or vim .fn .isdirectory (real_path ) == 1 then
301
- table.insert (files , real_path )
312
+ -- Validate that the path exists
313
+ if vim .fn .filereadable (real_path ) == 1 or vim .fn .isdirectory (real_path ) == 1 then
314
+ logger .debug (" integrations" , " adding to files: " .. real_path )
315
+ table.insert (files , real_path )
316
+ else
317
+ logger .debug (" integrations" , " path not readable/directory: " .. real_path )
318
+ end
319
+ else
320
+ logger .debug (" integrations" , " entry has no path or empty path" )
302
321
end
322
+ else
323
+ logger .debug (" integrations" , " no entry or pcall failed for line " .. tostring (line ))
303
324
end
304
325
end
305
326
327
+ logger .debug (" integrations" , " mini.files visual selection result: " .. # files .. " files found" )
328
+ for i , file in ipairs (files ) do
329
+ logger .debug (" integrations" , " file " .. i .. " : " .. file )
330
+ end
331
+
306
332
if # files > 0 then
307
333
return files , nil
308
334
end
0 commit comments