Skip to content

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Nov 4, 2025

Fixes #272118

Lets markdown strings use internal uris for links that should be handled entirely by the action handler instead of the opener. Uses this to support setting scope links

Fixes microsoft#272118

Lets markdown strings use internal uris for links that should be handled entirely by the action handler instead of the opener. Uses this to support setting scope links
@mjbvz mjbvz added this to the November 2025 milestone Nov 4, 2025
Copilot AI review requested due to automatic review settings November 4, 2025 00:40
@vs-code-engineering
Copy link

📬 CODENOTIFY

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

@bpasero

Matched files:

  • src/vs/base/browser/markdownRenderer.ts

Copy link
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 refactors link creation in markdown to use centralized helper functions instead of inline string concatenation. The changes introduce createMarkdownLink for general links and rename markdownCommandLink to createMarkdownCommandLink for consistency, adds support for internal URI scheme links, and updates all call sites across the codebase.

  • Refactored markdown link creation to use new helper functions createMarkdownLink and createMarkdownCommandLink
  • Added support for Schemas.internal in the markdown renderer and opener service
  • Introduced SettingScopeLink namespace for creating and parsing internal setting scope links

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/vs/base/common/htmlContent.ts Added createMarkdownLink function and renamed markdownCommandLink to createMarkdownCommandLink
src/vs/base/browser/markdownRenderer.ts Added Schemas.internal to allowed schemes in sanitizer config
src/vs/editor/browser/services/openerService.ts Added early return for internal scheme URIs to prevent them from being opened
src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts Replaced inline markdown link construction with createMarkdownLink, added SettingScopeLink namespace
src/vs/workbench/contrib/mcp/browser/mcpServersView.ts Updated to use createMarkdownCommandLink
src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.ts Updated to use createMarkdownCommandLink
src/vs/workbench/contrib/mcp/browser/mcpCommands.ts Updated to use createMarkdownCommandLink
src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatToolInvocationPart.ts Updated to use createMarkdownCommandLink
src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.ts Updated to use createMarkdownCommandLink
src/vs/workbench/contrib/chat/browser/chatContentParts/chatMcpServersInteractionContentPart.ts Updated to use createMarkdownCommandLink
src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.ts Updated to use createMarkdownCommandLink

let defaultOverrideHoverContent;
if (!Array.isArray(sourceToDisplay)) {
defaultOverrideHoverContent = localize('defaultOverriddenDetails', "Default setting value overridden by `{0}`", sourceToDisplay);
defaultOverrideHoverContent = localize('defaultOverriddenDetails', "Default setting value overridden by `{ 0 } `", sourceToDisplay);
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

The localization string contains incorrect spacing. Should be {0} instead of { 0 } .

Suggested change
defaultOverrideHoverContent = localize('defaultOverriddenDetails', "Default setting value overridden by `{ 0 } `", sourceToDisplay);
defaultOverrideHoverContent = localize('defaultOverriddenDetails', "Default setting value overridden by `{0}`", sourceToDisplay);

Copilot uses AI. Check for mistakes.
Comment on lines +653 to +655
export function parse(link: string): string {
const uri = URI.parse(link);
return decodeURIComponent(uri.query);
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

The parse function is used with optional chaining on line 483 (SettingScopeLink.parse(url)?.split(':')), but it always returns a string. It should return string | undefined to handle cases where the URI might be invalid or the query might be empty. Consider adding validation or changing the return type to match the usage pattern.

Suggested change
export function parse(link: string): string {
const uri = URI.parse(link);
return decodeURIComponent(uri.query);
export function parse(link: string): string | undefined {
const uri = URI.parse(link);
if (uri.query) {
return decodeURIComponent(uri.query);
}
return undefined;

Copilot uses AI. Check for mistakes.
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.

(Modified elsewhere) tool-tip in Settings no longer links to modified scopes

1 participant