fix image carousel image position detection.#303370
Open
Conversation
Contributor
There was a problem hiding this comment.
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 imageid. - Rework
findClickedImageIndexto 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
ChatResponseResourceURIs 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. |
DonJayamanne
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.