@@ -278,47 +278,24 @@ function M._get_mini_files_selection_with_range(start_line, end_line)
278
278
local files = {}
279
279
local bufnr = vim .api .nvim_get_current_buf ()
280
280
281
- local logger = require (" claudecode.logger" )
282
- logger .debug (" integrations" , " mini.files range selection:" )
283
- logger .debug (" integrations" , " start_line: " .. tostring (start_line ))
284
- logger .debug (" integrations" , " end_line: " .. tostring (end_line ))
285
-
286
281
-- Process each line in the range
287
282
for line = start_line , end_line do
288
- logger .debug (" integrations" , " processing line " .. tostring (line ))
289
283
local entry_ok , entry = pcall (mini_files .get_fs_entry , bufnr , line )
290
284
291
- if entry_ok and entry then
292
- logger .debug (" integrations" , " entry found: " .. tostring (entry .path ))
293
- if entry .path and entry .path ~= " " then
294
- -- Extract real filesystem path from mini.files buffer path
295
- local real_path = entry .path
296
- -- Remove mini.files buffer protocol prefix if present
297
- if real_path :match (" ^minifiles://" ) then
298
- real_path = real_path :gsub (" ^minifiles://[^/]*/" , " " )
299
- end
300
-
301
- logger .debug (" integrations" , " real_path: " .. tostring (real_path ))
285
+ if entry_ok and entry and entry .path and entry .path ~= " " then
286
+ -- Extract real filesystem path from mini.files buffer path
287
+ local real_path = entry .path
288
+ -- Remove mini.files buffer protocol prefix if present
289
+ if real_path :match (" ^minifiles://" ) then
290
+ real_path = real_path :gsub (" ^minifiles://[^/]*/" , " " )
291
+ end
302
292
303
- -- Validate that the path exists
304
- if vim .fn .filereadable (real_path ) == 1 or vim .fn .isdirectory (real_path ) == 1 then
305
- logger .debug (" integrations" , " adding to files: " .. real_path )
306
- table.insert (files , real_path )
307
- else
308
- logger .debug (" integrations" , " path not readable/directory: " .. real_path )
309
- end
310
- else
311
- logger .debug (" integrations" , " entry has no path or empty path" )
293
+ -- Validate that the path exists
294
+ if vim .fn .filereadable (real_path ) == 1 or vim .fn .isdirectory (real_path ) == 1 then
295
+ table.insert (files , real_path )
312
296
end
313
- else
314
- logger .debug (" integrations" , " no entry or pcall failed for line " .. tostring (line ))
315
297
end
316
298
end
317
-
318
- logger .debug (" integrations" , " mini.files range selection result: " .. # files .. " files found" )
319
- for i , file in ipairs (files ) do
320
- logger .debug (" integrations" , " file " .. i .. " : " .. file )
321
- end
322
299
323
300
if # files > 0 then
324
301
return files , nil
@@ -343,50 +320,25 @@ function M._get_mini_files_selection()
343
320
-- Visual mode: get visual range
344
321
local visual_commands = require (" claudecode.visual_commands" )
345
322
local start_line , end_line = visual_commands .get_visual_range ()
346
-
347
- -- Debug logging to see what range we got
348
- local logger = require (" claudecode.logger" )
349
- logger .debug (" integrations" , " mini.files visual mode detected:" )
350
- logger .debug (" integrations" , " mode: " .. tostring (mode ))
351
- logger .debug (" integrations" , " start_line: " .. tostring (start_line ))
352
- logger .debug (" integrations" , " end_line: " .. tostring (end_line ))
353
323
354
324
-- Process each line in the visual selection
355
325
for line = start_line , end_line do
356
- logger .debug (" integrations" , " processing line " .. tostring (line ))
357
326
local entry_ok , entry = pcall (mini_files .get_fs_entry , bufnr , line )
358
327
359
- if entry_ok and entry then
360
- logger .debug (" integrations" , " entry found: " .. tostring (entry .path ))
361
- if entry .path and entry .path ~= " " then
362
- -- Extract real filesystem path from mini.files buffer path
363
- local real_path = entry .path
364
- -- Remove mini.files buffer protocol prefix if present
365
- if real_path :match (" ^minifiles://" ) then
366
- real_path = real_path :gsub (" ^minifiles://[^/]*/" , " " )
367
- end
368
-
369
- logger .debug (" integrations" , " real_path: " .. tostring (real_path ))
328
+ if entry_ok and entry and entry .path and entry .path ~= " " then
329
+ -- Extract real filesystem path from mini.files buffer path
330
+ local real_path = entry .path
331
+ -- Remove mini.files buffer protocol prefix if present
332
+ if real_path :match (" ^minifiles://" ) then
333
+ real_path = real_path :gsub (" ^minifiles://[^/]*/" , " " )
334
+ end
370
335
371
- -- Validate that the path exists
372
- if vim .fn .filereadable (real_path ) == 1 or vim .fn .isdirectory (real_path ) == 1 then
373
- logger .debug (" integrations" , " adding to files: " .. real_path )
374
- table.insert (files , real_path )
375
- else
376
- logger .debug (" integrations" , " path not readable/directory: " .. real_path )
377
- end
378
- else
379
- logger .debug (" integrations" , " entry has no path or empty path" )
336
+ -- Validate that the path exists
337
+ if vim .fn .filereadable (real_path ) == 1 or vim .fn .isdirectory (real_path ) == 1 then
338
+ table.insert (files , real_path )
380
339
end
381
- else
382
- logger .debug (" integrations" , " no entry or pcall failed for line " .. tostring (line ))
383
340
end
384
341
end
385
-
386
- logger .debug (" integrations" , " mini.files visual selection result: " .. # files .. " files found" )
387
- for i , file in ipairs (files ) do
388
- logger .debug (" integrations" , " file " .. i .. " : " .. file )
389
- end
390
342
391
343
if # files > 0 then
392
344
return files , nil
0 commit comments