feat(web): open HTML files in the browser from the files context menu - #9533
Open
mrmg wants to merge 1 commit into
Open
feat(web): open HTML files in the browser from the files context menu#9533mrmg wants to merge 1 commit into
mrmg wants to merge 1 commit into
Conversation
Contributor
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. |
mrmg
force-pushed
the
feat/files-open-in-browser
branch
from
September 4, 2026 06:46
b3a0c30 to
041fff6
Compare
2 tasks
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.
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.