⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@pwang347
Copy link
Member

@pwang347 pwang347 commented Jan 9, 2026

Copilot AI review requested due to automatic review settings January 9, 2026 21:38
@pwang347 pwang347 requested a review from roblourens January 9, 2026 21:42
@pwang347 pwang347 marked this pull request as ready for review January 9, 2026 21:43
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 9, 2026
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 adds support for custom file link rendering metadata in the chat widget. The feature allows markdown links to specify custom display names for file references through JSON metadata in the link text.

Key changes:

  • Added support for parsing JSON metadata from link text to enable custom file name rendering
  • Updated InlineAnchorWidget constructor to accept optional metadata parameter
  • Modified file widget rendering logic to support both empty link text (existing behavior) and JSON metadata format

Reviewed changes

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

File Description
chatInlineAnchorWidget.ts Adds InlineAnchorWidgetMetadata type, implements JSON metadata parsing in renderFileWidgets(), updates InlineAnchorWidget constructor to accept metadata parameter, and uses metadata.fileName for custom display names
chatMarkdownDecorationsRenderer.ts Updates InlineAnchorWidget instantiation to pass undefined as the third parameter (metadata), maintaining backward compatibility
Comments suppressed due to low confidence (2)

src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.ts:66

		// Also support metadata format: [{"vscodeLinkType": "file", ...}](uri)

src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.ts:77

  • The metadata validation lacks a type guard to ensure the parsed JSON is an object. While the condition checks metadata && metadata.vscodeLinkType === 'file', if JSON.parse returns a primitive value (string, number, boolean) or an array, accessing metadata.vscodeLinkType won't throw an error but will return undefined, and the condition will silently fail. Add an explicit check that the parsed value is a plain object: metadata && typeof metadata === 'object' && !Array.isArray(metadata) before accessing its properties.
				metadata = JSON.parse(linkText);
				if (metadata && metadata.vscodeLinkType === 'file' && typeof metadata.fileName === 'string') {

@pwang347 pwang347 marked this pull request as ready for review January 10, 2026 00:56
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.

3 participants