Skip to content

fix image carousel image position detection.#303370

Open
rebornix wants to merge 1 commit intomainfrom
rebornix/theoretical-tiger
Open

fix image carousel image position detection.#303370
rebornix wants to merge 1 commit intomainfrom
rebornix/theoretical-tiger

Conversation

@rebornix
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings March 20, 2026 01:43
@rebornix rebornix self-assigned this Mar 20, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.113.0 milestone Mar 20, 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 fixes chat image carousel positioning by ensuring clicked image lookup prioritizes exact URI matches across all carousel sections (avoiding incorrect selection when multiple images share identical bytes), and by using tool-image URIs as the carousel image identifiers so tool outputs can be matched reliably.

Changes:

  • Update carousel section construction to use each extracted image’s uri.toString() as the carousel image id.
  • Rework findClickedImageIndex to do a URI-first pass across all sections, then fall back to data matching only if no URI match exists.
  • Add targeted tests covering the “identical data, different URI” case and ensuring tool output images use ChatResponseResource URIs as ids.

Reviewed changes

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

File Description
src/vs/workbench/contrib/chat/browser/chatImageCarouselService.ts Uses extracted uri as carousel image id and adjusts click-index resolution to prefer URI matches globally before falling back to data.
src/vs/workbench/contrib/chat/test/browser/chatImageCarouselService.test.ts Adds regression tests for URI-vs-data precedence and for tool output image ids being the tool image URI.

@rebornix rebornix marked this pull request as ready for review March 20, 2026 01:59
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