File Viewer
Inspect any file in a read-only modal with syntax highlighting, diff, and image preview.
File Viewer
The File Viewer is a modal overlay for inspecting any file without leaving Daintree. When an agent references a file path in its output, click it to see the contents right there, with full syntax highlighting and diff support. No switching to an external editor just to read a file.
Opening Files
There are two main ways to open the File Viewer:
- Click a file path in terminal output: Daintree detects file paths in agent and terminal output, including
path:line:colpatterns likesrc/index.ts:42:7. Clicking a detected path opens the File Viewer. - Click a changed file in the Review Hub or worktree sidebar: opens the File Viewer in Diff mode by default. See the Review Hub page for more on reviewing changes.
The modal header shows the branch name, the relative directory, and the filename. Hover over the title to see the full absolute path. An Open in Editor button sends the file to your external editor (configured in Settings > Integrations > External Editor) at the current line.
View Mode
View mode renders file content in a read-only editor with syntax highlighting. The language is detected from the file extension, covering 40+ languages including JavaScript, TypeScript, Python, Rust, and Go. Open a file from a path:line link, and the target line is highlighted and scrolled into view.
The editor includes:
- Line numbers in the gutter
- Code folding with clickable fold arrows next to collapsible blocks
- Metadata bar above the code showing line count, file size, and encoding (e.g.
142 lines · 4.2 KB · UTF-8) - In-viewer search (Cmd+F) with highlighted matches
- Go-to-line (Cmd+L) for jumping to a specific line number
Diff Mode
When a git diff is available for the file, a View / Diff toggle appears in the header. Files opened from the Review Hub or worktree sidebar default to Diff mode. Files opened from a terminal link with a specific line number default to View mode. You can switch between the two freely.
Diff mode features:
- Split or Unified layout toggle for side-by-side or single-column diffs
- Diff stats in the file header showing additions and deletions
- Copy Diff button to copy the raw unified diff to clipboard
Image Preview
Image files (PNG, JPG, GIF, WebP, BMP, ICO) render inline in the modal instead of showing a binary file error. SVG files are sanitized and shown as inline HTML. The header button changes to Open in Image Viewer, which opens the file in your system's default image viewer.
Keyboard Shortcuts
These shortcuts are live while the File Viewer is open:
| Shortcut | Action |
|---|---|
| Cmd+F | Open in-viewer search panel (View mode) |
| Cmd+L | Open go-to-line dialog (View mode) |
| Escape | Close the File Viewer (any mode) |
Limits and Error States
The File Viewer enforces hard size limits. They aren't configurable:
| Mode | Limit |
|---|---|
| View | 500 KB |
| Diff | 1 MB |
A file that exceeds these limits, or one that can't be displayed, shows one of these messages:
- Binary file: "Binary file — cannot display"
- Too large: "File too large to display" (the threshold matches the active mode: 500 KB in View, 1 MB in Diff)
- Not found: "File no longer exists"
- Outside project: "File is outside the project root"
- Invalid path: "Invalid file path"
In every error state, the Open in Editor button stays available as a fallback.