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

Open
opened 2026-02-16 18:05:13 -05:00 by yindo · 2 comments
Owner

Originally created by @iamseb4s on GitHub (Jan 19, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • 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.

Originally created by @iamseb4s on GitHub (Jan 19, 2026). Originally assigned to: @thdxr on GitHub. ### 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.
yindo added the discussionweb labels 2026-02-16 18:05:13 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 19, 2026):

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] commented on GitHub (Jan 19, 2026): 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.
Author
Owner

@HoangP8 commented on GitHub (Jan 30, 2026):

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 commented on GitHub (Jan 30, 2026): 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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6768