Update chat inline references after late anchor resolution#314281
Merged
vijayupadya merged 2 commits intoMay 9, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make late-resolved chat anchor metadata propagate through the chat response/rendering pipeline so inline anchors can refresh after richer symbol information arrives. It touches the response model, main-thread agent progress handling, markdown content diffing, and adds regression coverage around those flows.
Changes:
- Adds response-model support for resolving an existing inline reference by
resolveId. - Updates main-thread chat agent progress handling to write resolved anchor data back into the response model.
- Tightens markdown-content equality/incremental-update checks so inline-reference metadata changes can trigger re-rendering, with new tests covering those cases.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/common/model/chatModel.test.ts |
Adds response-model tests for resolving inline references. |
src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatMarkdownContentPart.test.ts |
Adds markdown-part tests for metadata comparisons and incremental rendering behavior. |
src/vs/workbench/contrib/chat/common/model/chatModel.ts |
Adds resolveInlineReference to the response model and implementation. |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.ts |
Makes markdown equality/incremental updates compare inline-reference metadata. |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.ts |
Removes a stale TODO related to late inline-reference resolution. |
src/vs/workbench/api/browser/mainThreadChatAgents2.ts |
Tracks unresolved anchors and applies resolved anchor data back into chat responses. |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.ts:466
- Metadata-only inline-reference updates are still treated as unchanged while a streaming edit pill is active. If the markdown text is unchanged but an inline reference resolves to richer symbol metadata, this fallback path returns
truebased only on the code-block fence position, so the part will skip the re-render that should refresh the anchor widget.
if (other.content.value === this.markdown.content.value && equalsInlineReferences(other.inlineReferences, this.markdown.inlineReferences)) {
return true;
}
// If we are streaming in code shown in an edit pill, do not re-render the entire content as long as it's coming in
const lastCodeblock = this._codeblocks.at(-1);
if (lastCodeblock && lastCodeblock.codemapperUri !== undefined && lastCodeblock.isStreamingEdit) {
return other.content.value.lastIndexOf('```') === this.markdown.content.value.lastIndexOf('```');
Comment on lines
+588
to
+595
| const unresolvedAnchorsForRequest = this._unresolvedAnchors.get(requestId); | ||
| if (!unresolvedAnchorsForRequest) { | ||
| return; | ||
| } | ||
|
|
||
| this._unresolvedAnchors.get(requestId)?.delete(handle); | ||
| const unresolvedAnchor = unresolvedAnchorsForRequest.get(handle); | ||
| if (!unresolvedAnchor) { | ||
| return; |
eleanorjboyd
approved these changes
May 6, 2026
Contributor
Author
|
@microsoft-github-policy-service agree |
roblourens
approved these changes
May 6, 2026
vijayupadya
approved these changes
May 9, 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.
Fixes late-resolved chat inline references so markdown link anchors can update after the extension host resolves richer symbol information, which is an outstanding TODO item.
Changes
resolveId.Testing
npm run compile-check-ts-nativenpm run test-browser-no-install -- --run src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatMarkdownContentPart.test.ts --grep "inline reference" --browser chromiumnpm run test-node -- --run src/vs/workbench/contrib/chat/test/common/model/chatModel.test.ts --grep "resolve inline reference"Part of #313533