Diff Viewer

Compare changes with unified and side-by-side views

Overview

The Diff Viewer shows code changes with syntax highlighting, helping you review modifications before committing or merging. Compare branches, view staged changes, or review pull requests directly in Agentastic.

Opening the Diff Viewer

From Source Control

  1. Open the Source Control Navigator (sidebar)
  2. Click on a modified file to see its diff
  3. Staged and unstaged changes are shown separately

From Command Palette

  1. Open Command Palette (Cmd+Shift+P)
  2. Type "diff" or "compare"
  3. Select the comparison you want

View Modes

The Diff Viewer supports two display modes. Toggle between them using the toolbar.

Unified View

A single-column view similar to GitHub's diff display:

  • Added lines highlighted in green
  • Removed lines highlighted in red
  • Context lines shown for reference
  • Line numbers from both old and new files

Best for: Quick reviews, smaller changes, linear reading.

Side-by-Side View

A two-column view showing old and new versions simultaneously:

  • Left column: original file
  • Right column: modified file
  • Changes aligned horizontally
  • Easy to compare exact differences

Best for: Large refactors, complex changes, detailed comparison.

Color Coding

ColorMeaning
Green backgroundAdded lines
Red backgroundRemoved lines
No highlightUnchanged context lines

Navigating Diffs

File List

The left panel shows all changed files:

  • Up/Down arrows - Navigate between files
  • Enter - Open selected file in editor
  • Click the toggle to show/hide the file list

Each file shows:

  • File path
  • Change count (+additions / -deletions)
  • Status icon (modified, added, deleted, renamed)

Within a Diff

  • Scroll to navigate through changes
  • Hunks are separated by context dividers
  • Click line numbers to jump to that line in the editor

Integration with Code Review

The Diff Viewer works seamlessly with Code Review:

  1. Review your changes in the Diff Viewer
  2. Click the Code Review button in the toolbar
  3. AI agents analyze the visible diff
  4. Review feedback appears in the terminal

Comparing Branches

When comparing branches, the Diff Viewer shows:

  • Base branch - The target branch (e.g., main)
  • Head branch - Your feature branch
  • All commits between the two branches
  • Complete unified diff

The title bar shows the comparison: feature-x vs main

File Status Icons

IconStatusDescription
MModifiedFile has changes
AAddedNew file
DDeletedFile removed
RRenamedFile moved/renamed

Keyboard Shortcuts

ActionShortcut
Open file in editorEnter
Navigate filesUp / Down
Toggle file listClick sidebar toggle

Tips

  • Review smaller chunks - Break large changes into smaller commits for easier review
  • Use side-by-side for refactors - When moving code around, side-by-side view helps track relocations
  • Check the summary - File list shows total additions/deletions at a glance
  • Combine with AI review - Use Code Review agents for automated feedback on your diff