Skip to content

chat: support inline attachment references#326666

Merged
justschen merged 6 commits into
mainfrom
justin/flapple
Jul 22, 2026
Merged

chat: support inline attachment references#326666
justschen merged 6 commits into
mainfrom
justin/flapple

Conversation

@justschen

Copy link
Copy Markdown
Collaborator
  • Lets users mention context that is already attached so prompts can express where a file, folder, image, pasted text, or other attachment is relevant without duplicating or removing it.
  • Keeps inline reference state lightweight so large attachment payloads do not cause typing lag, while preserving the original payload when the request is sent.
  • Prioritizes attached context in # and @ suggestions so existing context is easy to discover and reference.
  • Adds accessibility guidance and regression coverage for ordering, payload preservation, request ranges, and compact reference state.

(Commit message generated by Copilot)

- Lets users mention context that is already attached so prompts can express where a file, folder, image, pasted text, or other attachment is relevant without duplicating or removing it.
- Keeps inline reference state lightweight so large attachment payloads do not cause typing lag, while preserving the original payload when the request is sent.
- Prioritizes attached context in # and @ suggestions so existing context is easy to discover and reference.
- Adds accessibility guidance and regression coverage for ordering, payload preservation, request ranges, and compact reference state.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 20, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds inline references to existing chat attachments while preserving payloads and minimizing typing-state overhead.

Changes:

  • Adds compact attachment-reference state and request-range restoration.
  • Prioritizes attached context in # and @ completions.
  • Adds accessibility guidance and regression tests.
Show a summary per file
File Description
chatRequestParser.test.ts Tests payload and range preservation.
chatVariableEntries.test.ts Tests immutable variable replacement.
chatInputCompletions.test.ts Tests completion ranking and filtering.
chatVariables.test.ts Tests compact references and request reconstruction.
chatRequestParser.ts Passes attachment metadata into parsed parts.
chatParserTypes.ts Reconstructs full attachment entries.
common/attachments/chatVariables.ts Defines compact attachment conversions.
chatVariableEntries.ts Adds variable replacement helpers.
chatInputCompletionUtils.ts Adds attachment completion utilities.
chatInputCompletions.ts Provides prioritized attachment suggestions.
chatWidget.ts Preserves attachments while applying prompt ranges.
browser/attachments/chatVariables.ts Detects and applies existing references.
chatDynamicVariables.ts Compacts references to attached context.
chatAccessibilityHelp.ts Documents inline attachment references.

Review details

  • Files reviewed: 14/14 changed files
  • Comments generated: 2
  • Review effort level: Medium

Comment thread src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts Outdated
@justschen
justschen marked this pull request as ready for review July 21, 2026 23:08
@justschen
justschen enabled auto-merge (squash) July 21, 2026 23:08
@justschen
justschen requested a review from Copilot July 21, 2026 23:09
@justschen
justschen disabled auto-merge July 21, 2026 23:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 17/17 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment thread src/vs/workbench/contrib/chat/browser/attachments/chatVariables.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/attachments/chatVariables.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.ts Outdated
zhichli
zhichli previously approved these changes Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.ts:260

  • The lifetime check occurs before another await. If the attachment is removed/replaced or this contribution is disposed while thumbnail.arrayBuffer() resolves, the continuation repopulates the cleared hover cache and calls updateDecorations() on a disposed editor. Perform the attachment/disposal check after the final await.
		const thumbnail = await getOrCreateImageThumbnail(attachment.id, buffer, CHAT_IMAGE_HOVER_THUMBNAIL_MAX_SIZE);
		if (!thumbnail || !this.widget.input.attachmentModel.attachments.includes(attachment)) {
			return;
  • Files reviewed: 15/15 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread src/vs/workbench/contrib/chat/browser/attachments/chatDynamicVariables.ts Outdated
dmitrivMS
dmitrivMS previously approved these changes Jul 22, 2026
javi0guerrero4-cloud

This comment was marked as spam.

@justschen
justschen merged commit bc3ab21 into main Jul 22, 2026
29 checks passed
@justschen
justschen deleted the justin/flapple branch July 22, 2026 03:33
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 22, 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.

5 participants