Skip to content

Enhance image handling in chat attachments#301657

Merged
rebornix merged 4 commits intomainfrom
rebornix/fair-pig
Mar 14, 2026
Merged

Enhance image handling in chat attachments#301657
rebornix merged 4 commits intomainfrom
rebornix/fair-pig

Conversation

@rebornix
Copy link
Member

  • Introduced coerceImageBuffer function to standardize image data handling.
  • Updated ImageAttachmentWidget to utilize coerced image data for carousel display.
  • Enhanced collectCarouselSections to merge request and response images.
  • Added extractImagesFromChatRequest function for extracting user-attached images.
  • Expanded test coverage for image extraction and carousel section collection.

Support image attachments in chat request in Image Carousel.

- Introduced coerceImageBuffer function to standardize image data handling.
- Updated ImageAttachmentWidget to utilize coerced image data for carousel display.
- Enhanced collectCarouselSections to merge request and response images.
- Added extractImagesFromChatRequest function for extracting user-attached images.
- Expanded test coverage for image extraction and carousel section collection.
Copilot AI review requested due to automatic review settings March 14, 2026 05:34
@rebornix rebornix self-assigned this Mar 14, 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

Adds support for showing user-attached images (from chat requests) in the Chat Image Carousel, alongside existing response/tool/inline-reference images.

Changes:

  • Introduces coerceImageBuffer and extractImagesFromChatRequest to normalize and extract image attachment data from chat requests.
  • Updates carousel section collection to merge request attachment images with response-derived images, including pending-request handling.
  • Expands unit tests to cover request image extraction and carousel section collection behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/chatImageExtraction.ts Adds request-image extraction and buffer coercion utilities.
src/vs/workbench/contrib/chat/browser/chatImageCarouselService.ts Updates carousel section collection to include request attachments and pending requests.
src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts Uses coerced image data and enables carousel opening for more attachment shapes.
src/vs/workbench/contrib/chat/test/common/chatImageExtraction.test.ts Adds tests for extracting images from chat requests.
src/vs/workbench/contrib/chat/test/browser/chatImageCarouselService.test.ts Adds tests for request/response merging and pending request sections.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts:460

  • This condition enables pointer cursor + keyboard open handlers even when only imageData is present and the carousel feature is disabled, leading to a clickable UI that does nothing. Consider changing the condition to require either a resource, or (imageData && ImageCarouselEnabled) so interaction affordances match actual behavior.
		// Wire up click + keyboard (Enter/Space) open handlers
		if (resource || imageData) {
			this.element.style.cursor = 'pointer';
			this._register(registerOpenEditorListeners(this.element, async () => {
				await clickHandler();

@rebornix rebornix marked this pull request as ready for review March 14, 2026 05:57
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 14, 2026
@rebornix rebornix merged commit c770f37 into main Mar 14, 2026
20 checks passed
@rebornix rebornix deleted the rebornix/fair-pig branch March 14, 2026 18:22
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