Diff Review
Every LLM-issued code change flows through DiffReviewService. Line-level LCS diff, hunks with 3 lines of context, per-hunk accept/reject, undo history.
How it works
Section titled “How it works”When a change is proposed:
- Compute longest common subsequence diff between original + proposed.
- Group consecutive changes into hunks with 3 lines of context.
- Present via custom
TextDocumentContentProvider(scheme:codebuddy-diff). - Track for undo.
50-change undo history.
Review actions
Section titled “Review actions”| Action | Effect |
|---|---|
| Accept all | Apply every proposed change across all files |
| Accept file | Apply for one file only |
| Accept hunk | Apply a single hunk, leave others pending |
| Reject | Discard all changes |
| Edit | Modify the proposed changes before applying |
Hunks render: added lines green, removed lines red, 3 lines context above and below.
Auto-approve
Section titled “Auto-approve”{ "codebuddy.autoApprove": true }Auto-approve applies to safe operations (reads, searches, diagnostics). Write operations still show diffs unless codebuddy.requireDiffApproval is false.
Inline review comments
Section titled “Inline review comments”Review Selected Code + PR reviews annotate files inline via VS Code’s Comments API. InlineReviewService parses the LLM’s review output into severity-colored gutter annotations.
Severity:
| Severity | Icon | Meaning |
|---|---|---|
| Critical | 🔴 | Security vulnerability, data loss risk, crash |
| Moderate | 🟡 | Logic error, perf issue, bad practice |
| Minor | 🔵 | Style, naming, minor improvement |
| Info | ℹ️ | Suggestion, alternative approach |
Comments are read-only — informational. No reply widget.
Two-pass parser:
- JSON extraction — looks for a
REVIEW_COMMENTSJSON block in the LLM output. - Markdown fallback — parses markdown headers with severity indicators (🔴 / 🟡 / 🔵 emojis or “Critical Issues” / “Moderate Issues” headers).
Stops at non-issue sections (strengths, recommendations, optimizations) to avoid false positives.
Cap: 500 threads total to keep the editor responsive on large reviews.
Settings:
| Setting | Default | Purpose |
|---|---|---|
codebuddy.review.inlineComments | true | Enable inline thread annotations |
Commands:
Clear Inline Review Comments— remove all threads.
Pull-request review
Section titled “Pull-request review”Review Pull Request command:
- Detect changes — identify modified files vs. base branch.
- Base branch selection — auto-detect or prompt.
- Diff generation — compute diffs for all changed files.
- LLM review — send diff with a review-specific prompt.
- Inline annotations — appear as threads (when enabled).
- Summary — high-level summary in the chat panel.
The PR review prompt structures the diff for optimal LLM analysis (file paths, change types, surrounding context).
CodeBuddy: Undo Last ChangesOr built-in Cmd/Ctrl+Z for individual file undos. The diff service emits added / applied / rejected events that other services subscribe to for audit logging.