[FEATURE]: Integrated Manual File Editing via VS Code native diff editor
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Note: This builds upon and resolves the needs mentioned in #2167 and expands the discussion in #8003 by providing a full edit-and-sync implementation.
Problem
Currently, OpenCode handles file diffs exclusively within the TUI. While this is efficient for quick approvals, it lacks the flexibility for granular manual adjustments before committing a change. Users often need to make small corrections to the AI's output, a workflow that is currently cumbersome as it requires accepting the change first and then editing the file manually in a separate step.
Proposed Solution
I propose an integration that leverages the VS Code native diff editor when OpenCode is running in an integrated terminal. This provides a seamless "edit-and-approve" loop. Key features of the implementation:
- Automatic Environment Detection: Recognition of VS Code via TERM_PROGRAM to toggle between TUI and IDE modes without manual configuration.
- Interactive Native Editing: 'edit' permission requests open a native VS Code diff tab, allowing users to modify the proposed changes directly in the IDE buffer.
- Stateful Synchronization: Real-time IDE connection tracking via SSE with robust reconnection logic to ensure the CLI and IDE stay in sync across terminal restarts.
- TUI Feedback: A minimalist UI state in the terminal (connection indicator + animated status) to provide clear feedback when the editor has focus.
- Reliability: Integrated line-ending normalization to ensure consistent file writes from external IDE buffers.
Verification Performed
- Validated with a full production build using Bun 1.3.5 (standalone binary test).
- Verified SSE stability through server restarts and IDE reconnections.
- Full type-safety check passed with turbo typecheck.
I have a functional prototype ready. I would like to open a PR for design review to ensure this aligns with the project's roadmap.
This issue might be a duplicate of existing issues. Please check:
- #2167: Feature Request: manually edit the LLM-generated diffs via external editor
- #8003: VS Code Integration for Reviewing OpenCode Code Changes (Diff Preview)
Feel free to ignore if none of these address your specific case.
You may take a look at this: https://github.com/HoangP8/opencode-plugin-editor-diff View changed files directly in your editor — from the TUI. Try it out!
This is a highly useful feature that allows you to avoid vibe coding and instead use the agentic engineering approach. That's the only thing stopping me from migrating from Cline/Kilocode.
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.