Repository navigation
Preview as sidebar companion — extension-side changes (#931) - #936
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
jeonghun-jj-lee
marked this pull request as ready for review
September 9, 2026 18:27
…own (#919) Match the canonical preprocessMarkdown (newlines + trim) from the opencode fork's markdown-utils.ts. Updates 4 math-block assertions.
Sidebar entry: single-click → Preview, double-click → VS Code tab. Preview entry: reactive companion viewer in the side panel.
Add debounced click handling to sidebar file rows: - Single-click (250ms debounce) → sends 'open-file' (routed to Preview in slice 3) - Double-click → sends new 'open-file-editor' (opens native VS Code editor tab) Bridge changes: - Add OpenFileEditorMessage type (kind: 'open-file-editor') - Add openFileEditor optional handler to SidebarMessageHandlers - Add dispatch case in handleSidebarMessage - sidebar_view.ts implements openFileEditor via showTextDocument Tests (6 new): - Bridge: open-file-editor triggers handler, no-op when handler absent - Webview: debounce timer present, both message kinds emitted, 250ms delay, ghost entry guard precedes debounce All 2989 tests pass, 0 failures. Closes #932
Re-route the sidebar's openFile handler: instead of calling showTextDocument
directly, it now posts a { source: 'amicode', kind: 'preview-file', path }
message to the chat panel webview. The chat panel's session page listens for
this message and sets previewFile in the layout context (the opencode fork
side of #934).
Fallback: if the chat panel isn't open, falls back to showTextDocument.
Tests (2 new):
- openFile handler references preview-file and ChatPanel
- openFileEditor handler still uses showTextDocument
All 2991 tests pass, 0 failures.
Closes #934
…ion (#935) Re-route the chat bridge's open-file handler: instead of executing markdown.showPreview (for .md) or vscode.open (for everything else), it now posts { source: 'amicode', kind: 'preview-file', path } to the chat webview. This reuses the same preview-file pipeline built in #934 — the session page sets previewFile, opens the side panel, and switches to the Preview tab. Uniform routing: both sidebar single-clicks (from #932/#934) and chat file references now flow through the same preview-file bridge message. Tests (3 updated): - Markdown files route to preview-file (not markdown.showPreview) - Non-markdown files route to preview-file (not vscode.open) - Invalid/missing files: no preview-file posted, no commands executed All 2991 tests pass, 0 failures. Closes #935
The outer webview relay script has an explicit allowlist of message kinds that get forwarded from the extension host to the opencode iframe. The preview-file message was not in this list, so it was silently dropped — the sidebar posted the message, but it never reached the app's session page listener. Add 'preview-file' to both relay instances (primary panel + adopted panel). Test (1 new): verifies preview-file appears in both relay allowlists.
… PDFs (#934) openFileEditor used showTextDocument, which only works for text files. Binary files (images, PDFs) either showed garbled content or failed silently. Replace with vscode.commands.executeCommand('vscode.open', uri) which delegates to VS Code's file-type detection — images open in the built-in preview, PDFs in a PDF viewer extension, etc. Test (1 updated): asserts vscode.open, not showTextDocument.
- Zoom pill + edit/preview mode toggle as auto-hiding floating overlays - 2s idle fade with mouse/pinch reveal; hover pauses timer - Pinch/wheel zoom on markdown preview (transform: scale) - Save via serverSDK (auth-aware); autosave removed — Cmd+S only - .trim() removed from file read handler (fixes phantom git diffs) - Dirty dot with correct v2 design system tokens - Overlay nudged right: 14px to clear scrollbar - Sync overlay with opencode fork (e37f8eb68a)
jeonghun-jj-lee
force-pushed
the
amico/issue-931-preview-companion
branch
from
September 9, 2026 18:40
4ff6b2c to
131a477
Compare
New files created in the fork for the floating overlay refactor — needed by session-preview-tab.tsx imports.
…mports markdown-utils.ts, media.ts, selection-bridge.ts, session-diff.ts, session-review.tsx — all new in the fork, imported transitively by the Files Changed floating overlay refactor.
preview-editor.tsx, editor-core.ts, preview-nav-state.ts, markdown-shiki.worker.ts, and app/package.json (pdfjs-dist dep). Verified: materialized vite build passes locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preview as sidebar companion (#931)
Extension-side changes for the Preview companion redesign. Companion to harmoniqs/opencode#315 (app-side changes).
Commits
Sidebar single/double-click split #932 — Sidebar single/double-click split: Debounced click handler on file rows. Single-click (250ms) sends
open-file(routed to Preview). Double-click sendsopen-file-editor(opens native VS Code tab).Extension → Preview bridge (sidebar routing) #934 — Extension → Preview bridge: Re-routes the sidebar's
openFilehandler to post{ source: 'amicode', kind: 'preview-file', path }to the chat panel webview instead of callingshowTextDocument. Fallback to native editor if chat panel not open.Chat file-pill re-routing to Preview #935 — Chat file-pill re-routing: Re-routes the chat bridge's
open-filehandler to postpreview-fileinstead of executingmarkdown.showPreview/vscode.open. Uniform routing: both sidebar clicks and chat file references flow through the same pipeline.Test delta
open-filenow expectspreview-fileinstead of VS Code commands)Closes #932, closes #934, closes #935