Skip to content

Support browser context attachment#313315

Merged
kycutler merged 2 commits intomainfrom
kycutler/browsercontextattach
Apr 29, 2026
Merged

Support browser context attachment#313315
kycutler merged 2 commits intomainfrom
kycutler/browsercontextattach

Conversation

@kycutler
Copy link
Copy Markdown
Contributor

Closes #312169

Copilot AI review requested due to automatic review settings April 29, 2026 19:17
@kycutler kycutler self-assigned this Apr 29, 2026
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

Adds first-class support for attaching integrated browser tabs/pages as chat context, enabling explicit “attach” flows that can trigger page sharing and show browser attachments consistently alongside other attachment types.

Changes:

  • Introduces a new browserView chat variable entry kind and corresponding attachment widgets/rendering paths.
  • Adds browser-aware attachment resolution (including prompting to share the page with the agent).
  • Extends implicit context rendering to recognize browser resources and show proper labels/icons.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.ts Adds IBrowserViewVariableEntry and type guard; extends variable entry union.
src/vs/workbench/contrib/chat/browser/widget/media/chat.css Tweaks text-decoration behavior to support strikethrough inheritance for attachment labels.
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Renders browserView attachments in the input attachment pills via BrowserViewAttachmentWidget.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.ts Renders browserView attachments in the chat transcript attachments area.
src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.ts Adds browser implicit-context label rendering (globe icon + live label updates).
src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.ts Suggests active browser tab as implicit context and adjusts implicit-entry export behavior.
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts Implements BrowserViewAttachmentWidget for browser attachments (status, hover, open behavior).
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.ts Resolves browser view attachments and prompts to share when needed.
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.ts Routes vscodeBrowser URIs through the attachment resolve service when adding files.
src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts Enables attaching browser resources from the “Attach Context” quick pick flow.
src/vs/workbench/contrib/browserView/common/browserEditorInput.ts Adds onDidResolveModel and isSharingAvailable helpers to support attachment UI behavior.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.ts:259

  • renderBrowserResource() sets the label text/icon but doesn’t reflect whether the implicit context is disabled (e.g. via label strikethrough). After the CSS change, the disabled state may no longer be obvious for browser implicit context. Consider accepting an enabled (or disabled) parameter and setting strikethrough/title consistently with the file branch.
	private renderBrowserResource(browserUri: URI, label: IResourceLabel, contextNode: HTMLElement): string | undefined {
		const id = BrowserViewUri.getId(browserUri);
		const input = id && this.browserViewService.getKnownBrowserViews().get(id);
		if (!input) {
			return undefined;
		}

		const update = () => {
			label.setLabel(input.getName(), undefined, { iconPath: Codicon.globe });
			contextNode.ariaLabel = localize('chat.implicitBrowserContext', "Suggested browser context, {0}", input.getName());
		};
  • Files reviewed: 11/11 changed files
  • Comments generated: 8

Comment thread src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.ts Outdated
@kycutler kycutler marked this pull request as ready for review April 29, 2026 21:17
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@jruales

Matched files:

  • src/vs/workbench/contrib/browserView/common/browserEditorInput.ts

@kycutler kycutler merged commit fbce3ed into main Apr 29, 2026
26 checks passed
@kycutler kycutler deleted the kycutler/browsercontextattach branch April 29, 2026 22:27
@vs-code-engineering vs-code-engineering Bot added this to the 1.119.0 milestone Apr 29, 2026
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.

Allow attaching browser tabs to chat to trigger sharing

3 participants