Skip to content

Commit 0bb247a

Browse files
committed
fix: implement proper mini.files visual selection at-mention support
- Add special handling for mini.files in send_at_mention_for_visual_selection - Use integrations module to get actual selected files instead of directory path - Send each selected file as a separate at-mention - Remove debug logging from init.lua This fixes the issue where mini.files visual selections were sending the directory instead of the individual selected files.
1 parent 7c9538a commit 0bb247a

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

lua/claudecode/init.lua

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,13 +1031,6 @@ function M._broadcast_at_mention(file_path, start_line, end_line)
10311031
lineEnd = end_line,
10321032
}
10331033

1034-
-- Debug logging to see what's being sent
1035-
logger.debug("command", "Sending at_mentioned with params:")
1036-
logger.debug("command", " filePath: '" .. tostring(formatted_path) .. "'")
1037-
logger.debug("command", " lineStart: " .. tostring(start_line))
1038-
logger.debug("command", " lineEnd: " .. tostring(end_line))
1039-
logger.debug("command", " is_directory: " .. tostring(is_directory))
1040-
10411034
local broadcast_success = M.state.server.broadcast("at_mentioned", params)
10421035
if broadcast_success then
10431036
return true, nil

lua/claudecode/selection.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,43 @@ function M.send_at_mention_for_visual_selection(line1, line2)
659659
return false
660660
end
661661

662+
-- Special handling for mini.files: use integrations module instead of selection system
663+
local current_ft = vim.bo.filetype
664+
if current_ft == "minifiles" then
665+
local integrations = require("claudecode.integrations")
666+
local files, err = integrations.get_selected_files_from_tree()
667+
668+
if err then
669+
logger.error("selection", "Failed to get mini.files selection: " .. err)
670+
return false
671+
end
672+
673+
if not files or #files == 0 then
674+
logger.warn("selection", "No files selected in mini.files.")
675+
return false
676+
end
677+
678+
-- Send each selected file as a separate at-mention
679+
local success_count = 0
680+
for _, file_path in ipairs(files) do
681+
local success, error_msg = claudecode_main.send_at_mention(file_path, nil, nil, "ClaudeCodeSend")
682+
if success then
683+
success_count = success_count + 1
684+
logger.debug("selection", "Sent mini.files selection: " .. file_path)
685+
else
686+
logger.error("selection", "Failed to send mini.files selection " .. file_path .. ": " .. (error_msg or "unknown error"))
687+
end
688+
end
689+
690+
if success_count > 0 then
691+
logger.debug("selection", "Successfully sent " .. success_count .. " mini.files selections.")
692+
return true
693+
else
694+
logger.error("selection", "Failed to send any mini.files selections.")
695+
return false
696+
end
697+
end
698+
662699
local sel_to_send
663700

664701
-- If range parameters are provided, use them (for :'<,'> commands)

0 commit comments

Comments
 (0)