-
Notifications
You must be signed in to change notification settings - Fork 21
fix: use signal-based diff acceptance instead of direct file writes #41
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes #33 - Change from direct file writing to signal-based communication with Claude Code - Plugin sends acceptance signal, Claude Code handles actual file modifications - Plugin reloads buffers after Claude Code completes file writes - Unified behavior for both <leader>da keymap and :w command - Clean up verbose debug logging and outdated comments Previously the plugin was directly writing to files when accepting diffs, which could cause issues. Now the plugin properly delegates file modifications to Claude Code through signal-based acceptance. Change-Id: Iae72c91da515c4167590cea75d123ff30d10c5f8 Signed-off-by: Thomas Kosiewski <tk@coder.com>
2b60f1f
to
8003708
Compare
- Document how to accept changes with :w and <leader>da - Document how to reject changes with :q, <leader>dq, etc. - Explain signal-based approach and buffer reloading - Note that users can edit diff buffer before accepting - Provide clear user guidance for diff workflows Change-Id: Ic000567fafabecea06aa1ac95a5c5465a0290622 Signed-off-by: Thomas Kosiewski <tk@coder.com>
- Use dynamic filename derivation instead of hardcoded 'new.lua.new' - Address Copilot feedback about brittle filename verification - Extract expected suffix from new_file_path for better maintainability Change-Id: Ie2c6932ce36f54863a6262956eb7cfc02c4ca9df Signed-off-by: Thomas Kosiewski <tk@coder.com>
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.
Pull Request Overview
Updates the diff acceptance flow to use a signal-based approach instead of direct file writes and aligns tests and docs with the new API.
- Switches plugin tests from
_create_temp_file
to_open_native_diff
, updating assertions forsuccess
,temp_file
, anderror
fields - Adds a new
filetype
annotation in the vim metadata module - Documents the native diff workflow and key mappings in the README
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/unit/diff_spec.lua | Refactored tests to call _open_native_diff and adjust result validations |
lua/claudecode/meta/vim.lua | Added vim_filetype_module class and filetype field annotation |
README.md | Added "Working with Diffs" section detailing new diff behavior |
- Add temp_file field to mocked _open_native_diff implementation - Ensure error case returns temp_file = nil explicitly - Add comprehensive error validation in tests - Improve test robustness and consistency docs: add terminal-based diff acceptance/rejection option - Document that users can accept/reject diffs from Claude Code terminal - Provide alternative workflow for terminal-focused users Change-Id: I5bee1fffb5cec40d0d593795ec1d8bb2dd2208be Signed-off-by: Thomas Kosiewski <tk@coder.com>
ThomasK33
added a commit
that referenced
this pull request
Jun 18, 2025
This release includes significant feature additions and bug fixes: **Version Updates:** - Updated main version table in lua/claudecode/init.lua (0.1.0-alpha → 0.2.0) - Updated client versions in scripts/claude_interactive.sh (3 locations) - Updated ClaudeCodeNvim version in scripts/lib_claude.sh - Removed prerelease flag for stable release **Documentation:** - Added comprehensive CHANGELOG.md with v0.2.0 release notes - Documented all merged PRs since v0.1.0 with proper references - Updated CLAUDE.md with detailed release process documentation - Fixed diff keymap references in README.md (<leader>da → <leader>aa) **Features Added (since v0.1.0):** - Diagnostics integration (#34) - File explorer support for oil.nvim, nvim-tree, neotree (#27, #22) - Enhanced terminal management with ClaudeCodeFocus command (#40) - Auto terminal provider detection (#36) - Customizable diff keymaps via LazyVim spec (#47) **Bug Fixes:** - Terminal focus errors when buffer hidden (#43) - Improved diff acceptance behavior (#41) - Fixed syntax highlighting in proposed diff view (#32) - Visual selection range handling improvements (#26) - Native terminal bufhidden behavior (#39) All code quality checks pass and documentation is updated for maintainability. Change-Id: I0e4e7c9bae98df922356dc8b8aa0acd7e8293a48 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Merged
ThomasK33
added a commit
that referenced
this pull request
Jun 18, 2025
This release includes significant feature additions and bug fixes: **Version Updates:** - Updated main version table in lua/claudecode/init.lua (0.1.0-alpha → 0.2.0) - Updated client versions in scripts/claude_interactive.sh (3 locations) - Updated ClaudeCodeNvim version in scripts/lib_claude.sh - Removed prerelease flag for stable release **Documentation:** - Added comprehensive CHANGELOG.md with v0.2.0 release notes - Documented all merged PRs since v0.1.0 with proper references - Updated CLAUDE.md with detailed release process documentation - Fixed diff keymap references in README.md (<leader>da → <leader>aa) **Features Added (since v0.1.0):** - Diagnostics integration (#34) - File explorer support for oil.nvim, nvim-tree, neotree (#27, #22) - Enhanced terminal management with ClaudeCodeFocus command (#40) - Auto terminal provider detection (#36) - Customizable diff keymaps via LazyVim spec (#47) **Bug Fixes:** - Terminal focus errors when buffer hidden (#43) - Improved diff acceptance behavior (#41) - Fixed syntax highlighting in proposed diff view (#32) - Visual selection range handling improvements (#26) - Native terminal bufhidden behavior (#39) All code quality checks pass and documentation is updated for maintainability. Change-Id: I0e4e7c9bae98df922356dc8b8aa0acd7e8293a48 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #33 by changing the diff acceptance approach from direct file writing to signal-based communication with Claude Code.
Changes Made
<leader>da
keymap and:w
command now use the same signal-based approachTechnical Details
Previously, the plugin was directly writing to files when accepting diffs, which could cause issues. Now the plugin sends Claude Code a signal that the diff was accepted, Claude Code handles the actual file modifications, and the plugin reloads the affected buffers to reflect the changes.