-
Notifications
You must be signed in to change notification settings - Fork 61
feat: support send-to-claude for snacks.explorer
#68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: support send-to-claude for snacks.explorer
#68
Conversation
…end) This PR aims to add an equivalent "ClaudeCodeSend" integration for snacks.explorer, as what already exists for nvim-tree, neo-tree and oil.nvim Snacks.explorer seems to have become the default LazyVim file explorer, and has gained a fair bit of traction. - Add snacks_picker_list filetype detection across the codebase - Implement _get_snacks_explorer_selection() to handle file selection - Support both individual selection and current file fallback - Handle visual mode for snacks.explorer in visual commands - Add comprehensive test coverage for the new integration
…xplorer Enable selecting multiple files in snacks.explorer using vim's visual mode. This brings the snacks.explorer integration up to par with others, such as oil, nvim-tree and NvimTree - Pass visual range parameters to _get_snacks_explorer_selection() - Use picker's list API to convert row numbers to items (row2idx/get) - Handle edge cases like nil items and empty file paths - Add comprehensive test coverage for visual selection scenarios
- Fix helpers module usage in snacks_explorer_spec.lua (return function, not table) - Add missing vim.fn.isDirectory() and vim.bo to test mocks - Fix is_safe_path() to properly filter system files (/etc/, /usr/, /bin/, /sbin/) - All 326 tests now pass successfully
dc3c2e1
to
6fd3196
Compare
Change-Id: I6c810fbb8c3c0eedcff14ebe491f2f5825ee209f Signed-off-by: Thomas Kosiewski <[email protected]>
Change-Id: I6c28f07bace2e3236e6cc054a5e56dc49e6dc125 Signed-off-by: Thomas Kosiewski <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @andresthor.
Just so you know, I've pushed a fixture for the snacks explorer onto your branch to check if it works.
Can we please remove the 'security' features of omitting specific paths?
-- Helper function to check if path is safe (not root-level) | ||
local function is_safe_path(file_path) | ||
if not file_path or file_path == "" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding this?
If I navigate to /etc
in my file explorer, I want the file to be propagated as an @
mention.
@@ -24,7 +24,7 @@ return { | |||
"<leader>as", | |||
"<cmd>ClaudeCodeTreeAdd<cr>", | |||
desc = "Add file from tree", | |||
ft = { "NvimTree", "neo-tree", "oil" }, | |||
ft = { "NvimTree", "neo-tree", "oil", "snacks_picker_list" }, -- snacks.explorer uses "snacks_picker_list" filetype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, but this comment doesn't add any context here.
Add send-to-claude for the
folke/snacks.explorer
to work with the pluginIt looks like
Snacks.explorer
has become the default file browser for LazyVim, so it makes sense we'll start seeing more of those feature requests.Adds support for snacks.explorer to claudecode.nvim, bringing feature parity with existing file explorer integrations, such as
nvim-tree
,neo-tree
andoil.nvim
.Implementation
Follows established patterns in
integrations.lua
:snacks_picker_list
filetype_get_snacks_explorer_selection()
using picker APIFeatures
/etc/passwd
,/usr/bin/vim
)Testing
Comprehensive test coverage:
Documentation
snacks_picker_list
filetypeEnables snacks.explorer users to add files to Claude's context using familiar vim motions, just like other supported file explorers.