Skip to content

Add setting to open non-localhost links in Integrated Browser#316530

Draft
Copilot wants to merge 8 commits into
mainfrom
copilot/add-integration-browser-setting
Draft

Add setting to open non-localhost links in Integrated Browser#316530
Copilot wants to merge 8 commits into
mainfrom
copilot/add-integration-browser-setting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

This change adds a dedicated setting to route non-localhost HTTP(S) links into the Integrated Browser, complementing the existing localhost-only behavior. Link routing now selects the appropriate setting based on URL authority instead of hardcoding localhost checks in the opener contribution.

  • Configuration

    • Added workbench.browser.openExternalLinks to open non-localhost HTTP(S) links in the Integrated Browser.
    • Kept existing workbench.browser.openLocalhostLinks semantics unchanged for localhost/all-interfaces targets.
  • Link opener behavior

    • Extracted URL classification into browserLinkOpeners.ts so opener decisions are centralized.
    • Updated opener contribution to:
      • choose setting by URL class (localhost/all-interfaces vs external),
      • preserve default-setting hint behavior using the selected setting key,
      • emit distinct telemetry source (externalLinkOpener vs localhostLinkOpener).
  • Structure and naming

    • Renamed contribution to BrowserLinkOpenerContribution with ID workbench.contrib.browserLinkOpener to reflect expanded scope.
  • Targeted coverage

    • Added focused unit tests for URL classification and setting selection behavior.
const openerSetting = getIntegratedBrowserLinkOpenerSetting(
	href,
	config.getValue<boolean>('workbench.browser.openLocalhostLinks'),
	config.getValue<boolean>('workbench.browser.openExternalLinks')
);

Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 00:17
Copilot AI linked an issue May 15, 2026 that may be closed by this pull request
Co-authored-by: jruales <1588988+jruales@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 00:32
Co-authored-by: jruales <1588988+jruales@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 00:38
Copilot AI changed the title [WIP] Add option to open all links in integrated browser Add setting to open non-localhost links in Integrated Browser May 15, 2026
Copilot AI requested a review from jruales May 15, 2026 00:38
Comment thread src/vs/workbench/contrib/browserView/common/browserLinkOpeners.ts
Co-authored-by: jruales <1588988+jruales@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 01:03
Copilot AI requested a review from jruales May 15, 2026 01:04
Comment thread src/vs/workbench/contrib/browserView/common/browserLinkOpeners.ts Outdated
Co-authored-by: jruales <1588988+jruales@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 02:09
Copilot AI requested a review from jruales May 15, 2026 02:10
@jruales jruales requested a review from kycutler May 15, 2026 17:48
@jruales
Copy link
Copy Markdown
Contributor

jruales commented May 15, 2026

@copilot resolve the merge conflicts in this pull request

@jruales jruales marked this pull request as ready for review May 15, 2026 17:49
Copilot AI review requested due to automatic review settings May 15, 2026 17:49
@jruales
Copy link
Copy Markdown
Contributor

jruales commented May 15, 2026

@copilot also update the PR description to reflect the latest changes

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds configurable Integrated Browser routing for non-localhost HTTP(S) links, alongside the existing localhost/all-interfaces behavior.

Changes:

  • Adds workbench.browser.openExternalLinks.
  • Extracts URL-to-setting classification into a shared helper with tests.
  • Updates opener telemetry/source naming for external-link opens.
Show a summary per file
File Description
src/vs/workbench/contrib/browserView/common/browserLinkOpeners.ts Adds helper for classifying HTTP(S) links to the relevant opener setting.
src/vs/workbench/contrib/browserView/test/common/browserLinkOpeners.test.ts Adds unit coverage for localhost, external, and invalid/non-HTTP(S) links.
src/vs/workbench/contrib/browserView/electron-browser/features/browserTabManagementFeatures.ts Uses the helper in the opener contribution and registers the new setting.
src/vs/platform/browserView/common/browserViewTelemetry.ts Adds telemetry source for external-link opener usage.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

Co-authored-by: jruales <1588988+jruales@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 15, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in ae2dcdc7: merged origin/main into this branch and fixed the conflict in browserTabManagementFeatures.ts while preserving the PR’s integrated-browser link opener behavior.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 15, 2026

@copilot also update the PR description to reflect the latest changes

Updated the PR description to reflect the latest state of the branch, including the setting-key classification refactor, caller-side config lookup, and the merge-resolution result in ae2dcdc7.

jruales and others added 2 commits May 15, 2026 11:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: jruales <1588988+jruales@users.noreply.github.com>
),
agentsWindow: { default: true },
},
'workbench.browser.openExternalLinks': {
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.

I think I'd prefer to have a list of rules for which links to open or not -- some things like GitHub might stay better in the browser while e.g docs should be opened in VS Code. I'm thinking something like gitignore syntax but for URLs, or a list of items with a pattern and dropdown for whether it should be opened internally or externally.

return false;
}
} catch {
const openerSetting = getIntegratedBrowserLinkOpenerSetting(href);
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.

It seems weird to get the configuration key in a helper, but then test the actual value here? Might make more sense to have a shouldOpenInIntegratedBrowser helper that just takes the URL and config service. I also question the value of having a whole new file for this one helper that is only used here.

@jruales jruales marked this pull request as draft May 15, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to open all links in Integrated Browser

5 participants