JAI: Diff Editor (lite-diff)
100% AI Code · Human Reviewed

Working with AI assistants like Claude or ChatGPT? Tired of manually applying code patches?
This extension brings unified diff format to your IDE workflow. Apply AI-generated patches with preview, automatic backups, and drift detection.
Based on the lite-diff specification.
- Before: Copy patches from AI chat → Manually find and edit each location → Hope nothing breaks
- After: Paste lite-diff patch → Preview changes in VS Code diff viewer → Apply with one click
Features
- In-file edits — Replace, delete, insert with familiar unified diff syntax
- Insert at file start/end — Use
@@ BOF and @@ EOF for file start/end
- Boundary blocks — Delete ranges between two marker lines using
...
- Global options — Ignore whitespace, blank lines, apply to all matches
- Preview mode — See exact changes in VS Code diff viewer before applying
- Multi-file support — Process multiple files in a single patch
- Automatic backups — Every change creates a backup in
.ldiff/ directory
- MCP Server — Integrate with Cursor IDE and Claude Desktop for AI-assisted patching
Quick Start
- Open Command Palette (
Ctrl/Cmd+Shift+P)
- Run
JAI: Diff Editor (lite-diff)
- Paste your lite-diff patch
- Review changes in diff viewer, then apply

Syntax Guide
Basic Edit
--- file.txt
+++ file.txt
@@
context line (unchanged)
-old line
+new line
Insert at File Start
--- file.txt
+++ file.txt
@@ BOF
+first line
+second line
Insert at File End
--- file.txt
+++ file.txt
@@ EOF
+last line
Note: After @@ BOF and @@ EOF only + lines are allowed. Context ( ) or deletion (-) lines will cause error E411.
Delete Range (Boundary Block)
--- file.txt
+++ file.txt
@@
-start boundary
...
-end boundary
+replacement
Deletes everything from "start boundary" to "end boundary" inclusive, then inserts replacement.
Rules for boundary blocks:
... cannot appear at the start or end of the block
- Two
... in a row without - line between them are forbidden
- Each boundary must have
- lines on both sides
Global Options
Add at the beginning of your patch, before any diff block:
--ignore-space-at-eol
--ignore-blank-lines
--- file.txt
+++ file.txt
@@
context line
-old line
+new line
| Option |
Description |
--ignore-space-at-eol |
Ignore trailing whitespace at end of lines |
--ignore-space-change |
Ignore changes in whitespace quantity (but not presence) |
--ignore-blank-lines |
Ignore blank lines when matching context |
--ignore-all-space |
Ignore all whitespace differences |
--apply-all-matches |
Apply hunk to all occurrences (single hunk only) |
Important Rules
- All structural elements must begin at the first position (no indentation):
---, +++, @@, -, +, (context), ..., #, --
- No blank lines allowed inside hunk body (from
@@ to the next @@ or end of diff block)
- Comments start with
# at the first position on a separate line
- Preview creates directories
.ldiff/<TIMESTAMP>/original/ and .ldiff/<TIMESTAMP>/preview/
Common Errors
| Error |
Cause |
Solution |
| E410 "No match found" |
Context doesn't match file |
Verify exact line match or use --ignore-* options |
| E401 "Invalid prefix" |
Line doesn't start with , -, +, #, or ... |
Fix prefix or remove leading whitespace |
| E402 "Blank line inside hunk" |
Empty line in hunk body |
Remove or use prefix for empty context |
| E411 "Invalid content after BOF/EOF" |
Non-+ line after @@ BOF/EOF |
Use only + lines after BOF/EOF |
| E304 "Multiple hunks with --apply-all-matches" |
--apply-all-matches with >1 hunk |
Split into separate diff blocks |
| E724 "Drift detected" |
File changed after preview |
Re-run preview before applying |
Configuration
| Setting |
Default |
Description |
diffEditor.verboseLogging |
false |
Enable verbose logging for debugging |
diffEditor.backupLimit |
5 |
Max backup packages to keep (0 = only active) |
Contributing
Found a bug or have a feature request? Please open an issue on GitHub.
License
This extension is proprietary software. See LICENSE for details.
The lite-diff specification is licensed under CC BY 4.0. This license applies to the specification only and does not grant any rights to this extension's source code or binaries — you're free to create your own implementations of the spec.
🚀 Created by Claude Opus 4.5, ChatGPT 5 Pro