Skip to content

Auto-reload Integrated Browser when previewed local file changes - #324618

Merged
Kyle Cutler (kycutler) merged 4 commits into
microsoft:mainfrom
karthikkatu:main
Aug 3, 2026
Merged

Auto-reload Integrated Browser when previewed local file changes#324618
Kyle Cutler (kycutler) merged 4 commits into
microsoft:mainfrom
karthikkatu:main

Conversation

@karthikkatu

Copy link
Copy Markdown
Contributor

ISSUE #324391 : Integrated browser: auto-reload HTML files on change

Adds a BrowserEditorContribution that watches the currently-displayed file:// URL via a correlated file watcher and reloads the browser on change, so editing an local file opened with "Open in Integrated Browser" refreshes the preview without a manual reload. Gated by the new workbench.browser.autoReloadOnFileChange setting (on by default).

Adds a BrowserEditorContribution that watches the currently-displayed
file:// URL via a correlated file watcher and reloads the browser on
change, so editing a local file opened with "Open in Integrated
Browser" refreshes the preview without a manual reload. Gated by the
new workbench.browser.autoReloadOnFileChange setting (on by default).
Copilot AI review requested due to automatic review settings July 6, 2026 20:04
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Kyle Cutler (@kycutler)

Matched files:

  • src/vs/workbench/contrib/browserView/electron-browser/browserView.contribution.ts
  • src/vs/workbench/contrib/browserView/electron-browser/features/browserAutoReloadFeatures.ts

Joaquín Ruales (@jruales)

Matched files:

  • src/vs/workbench/contrib/browserView/electron-browser/browserView.contribution.ts
  • src/vs/workbench/contrib/browserView/electron-browser/features/browserAutoReloadFeatures.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements auto-reload for the Integrated Browser (VS Code's browserView — a native Chromium WebContentsView presented as an editor tab). It adds a new BrowserEditorContribution that, whenever the displayed page is a file:// URL, starts a correlated non-recursive file watcher on that file and reloads the browser (debounced by 300ms) when the file is updated or re-added on disk. This addresses issue #324391, removing the need to manually reload local HTML previews after edits. The behavior is gated by a new default-on setting workbench.browser.autoReloadOnFileChange.

The implementation follows the established local contribution model: it hooks the model lifecycle via onModelAttached, scopes the watcher to the attached model (re-setting up on navigation and configuration changes), and cleans up through DisposableStore/MutableDisposable — consistent with sibling features like the zoom and emulation contributions.

Changes:

  • New BrowserEditorAutoReloadContribution that watches the current file:// URL and reloads the browser on change, gated behind a new setting.
  • Registers the workbench.browser.autoReloadOnFileChange boolean configuration (default true).
  • Wires the new feature into the desktop browserView contribution entry point.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/browserView/electron-browser/features/browserAutoReloadFeatures.ts New contribution + setting: watches the displayed local file and reloads the browser on change.
src/vs/workbench/contrib/browserView/electron-browser/browserView.contribution.ts Side-effect import to register the new auto-reload feature.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@kycutler Kyle Cutler (kycutler) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good 🙂 thank you for the PR Karthikeyan M (@karthikkatu)!

@kycutler
Kyle Cutler (kycutler) merged commit 0b1baf6 into microsoft:main Aug 3, 2026
46 of 47 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.133.0 milestone Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants