Repository navigation
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new file-browser context-menu workflow for opening HTML and PDF files in the integrated browser, plus workspace path-resolution behavior. The change is localized and user-initiated, but the new interaction lacks targeted test coverage and should receive human review. You can add or adjust custom eligibility rules. Learn more. |
b3a0c30 to
041fff6
Compare
|
Note This comment is posted by Julius' dot Closing under the prior-approval rule. The preview header already opens these files in the integrated browser; this adds another interaction to address discoverability. There is no linked maintainer approval for the new menu action. Please discuss the discoverability problem in Ideas and obtain scope approval before requesting reconsideration. |
Problem
Right-clicking an HTML file in the files panel only offers "Copy mention" and "Add to chat". Opening the file drops you into the code view, and the only way to see it rendered is to first open the file and then find the small globe button in the preview header. Nothing in the tree menu hints a browser view exists.
Fix
.html/.htm/.pdf), shown as the first item.isPreviewSupportedInRuntime()(integrated browser present) plus an environment HTTP base URL. On web and mobile it simply doesn't appear, matching the existing header button.FilePreviewPanel.handleOpenInBrowsernow takes the file path and resolves it againstcwd, so the header globe button and the new menu item share one code path (including its error toast).Test plan
tsgo --noEmit,vp lint,FilePreviewPanelunit tests (8/8)index.htmlin files → menu shows "Open in browser" → opens the file in the browser surface.pdftooScreenshots
Made with GLM-5.3-Flash in T3 Code.
Note
Low Risk
UI-only file explorer and preview wiring with a small, well-scoped path helper; no auth or persistence changes.
Overview
Adds Open in browser as the first item on the file tree right-click menu for workspace files that support integrated preview (e.g. HTML/HTM/PDF), when the runtime has an integrated browser and an environment HTTP base URL.
The tree wires this through a new optional
onOpenInBrowserprop fromFilePreviewPanel, which reuses the sameopenFileInPreviewflow and error toast as the preview header globe button.handleOpenInBrowsernow takes a workspace-relative path instead of relying on a pre-resolved absolute path.Path resolution for the file panel switches from terminal-link
resolvePathLinkTargetto newresolveWorkspaceFilePath, so a leading~/inside the workspace is treated as a literal folder name, not home-directory expansion.Reviewed by Cursor Bugbot for commit 041fff6. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add "Open in browser" action to
FileBrowserPanelcontext menuonOpenInBrowsercallback toFileBrowserPanelPropsthat displays an "Open in browser" context menu item for eligible filesFilePreviewPanelprovides this callback when the runtime supports browser preview and an environment HTTP base URL is availableresolveWorkspaceFilePathin terminal-links.ts to resolve relative paths against the workspace rootFilePreviewPanelresolves browser-opening and preview file paths usingresolveWorkspaceFilePath, which treats a leading~/segment as a literal directory rather than expanding it to the user's home directoryMacroscope summarized 041fff6.