opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Integrated Manual File Editing via VS Code native diff editor

Open iamseb4s opened this issue 10 months ago • 4 comments

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.

iamseb4s avatar Jan 19 '26 09:01 iamseb4s

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.

github-actions[bot] avatar Jan 19 '26 09:01 github-actions[bot]

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!

HoangP8 avatar Jan 30 '26 16:01 HoangP8

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.

bibendi avatar Mar 07 '26 18:03 bibendi

To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

github-actions[bot] avatar Jul 06 '26 03:07 github-actions[bot]