Skip to content

Conversation

@alexr00
Copy link
Member

@alexr00 alexr00 commented Jan 16, 2026

Part of #280658

Copilot AI review requested due to automatic review settings January 16, 2026 16:56
@alexr00 alexr00 enabled auto-merge (squash) January 16, 2026 16:56
@alexr00 alexr00 self-assigned this Jan 16, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 16, 2026
dmitrivMS
dmitrivMS previously approved these changes Jan 16, 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 tooltip support to chat context items by introducing an optional tooltip field of type MarkdownString. The tooltip displays when users hover over context items in the chat UI, providing additional information beyond the label.

Changes:

  • Added tooltip?: MarkdownString field to the VS Code API's ChatContextItem interface
  • Added tooltip?: IMarkdownString to internal interfaces for chat context items and variable entries
  • Implemented tooltip rendering in attachment widgets using IHoverService.setupDelayedHover

Reviewed changes

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

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatContextProvider.d.ts Added tooltip?: MarkdownString field to the proposed API's ChatContextItem interface
src/vs/workbench/contrib/chat/common/contextContrib/chatContext.ts Added tooltip?: IMarkdownString to IChatContextItem interface
src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.ts Added tooltip?: IMarkdownString to StringChatContextValue and IChatRequestStringVariableEntry interfaces
src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.ts Updated service to propagate tooltip values during context resolution
src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.ts Implemented tooltip rendering for implicit context attachments using conditional hover setup
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts Added tooltip rendering for default attachment widgets with updateTooltip method
src/vs/workbench/api/common/extHostChatContext.ts Added type conversion for tooltip field using MarkdownString.from() converter

appearance: { showPointer: true },
}));
} else if (title) {
this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), this.domNode, title));
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The hover should be registered with renderDisposables instead of this._register() to ensure it's cleaned up when the attachment is re-rendered. The markdown tooltip hover on line 141 is correctly registered with renderDisposables, but this one uses this._register(), which won't be disposed when render() is called again.

Suggested change
this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), this.domNode, title));
this.renderDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), this.domNode, title));

Copilot uses AI. Check for mistakes.
});
}

public updateTooltip(tooltip: IMarkdownString | undefined): void {
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The updateTooltip method is declared as public but is never called from outside the class. Consider making it private since it's not part of the public API and there's no evidence it needs to be exposed externally.

Suggested change
public updateTooltip(tooltip: IMarkdownString | undefined): void {
private updateTooltip(tooltip: IMarkdownString | undefined): void {

Copilot uses AI. Check for mistakes.
@alexr00 alexr00 disabled auto-merge January 16, 2026 17:08
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

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

this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), this.domNode, title));
if (markdownTooltip || title) {
this.renderDisposables.add(this.hoverService.setupDelayedHover(this.domNode, {
content: markdownTooltip! ?? title!,
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The non-null assertion on title is unnecessary here. Since the guard condition checks if (markdownTooltip || title), we know at least one is truthy, and the nullish coalescing operator will only evaluate title if markdownTooltip is nullish. Consider simplifying to content: markdownTooltip ?? title! or better yet, content: (markdownTooltip ?? title)! to make the intent clearer.

Suggested change
content: markdownTooltip! ?? title!,
content: (markdownTooltip ?? title)!,

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.

3 participants