Skip to content

Comments

Show attachments toolbar for implicit context in Ask mode and selections#296630

Merged
daviddossett merged 3 commits intomainfrom
ddossett/scientific-catshark
Feb 20, 2026
Merged

Show attachments toolbar for implicit context in Ask mode and selections#296630
daviddossett merged 3 commits intomainfrom
ddossett/scientific-catshark

Conversation

@daviddossett
Copy link
Collaborator

Summary

Shows the attachments toolbar when implicit context is visible, specifically:

  • Ask mode: The active editor file is shown as an attached context item in the toolbar (with dismiss/add controls)
  • Selections: When a user makes a text selection in the editor, the toolbar appears with the selection shown as an attachment (with pin functionality)

The toolbar remains hidden in Agent mode when there's no selection and no explicit attachments.

Changes

chatInputPart.ts:

  • Import ImplicitContextAttachmentWidget and Range/IRange
  • In renderAttachedContext(), instantiate the ImplicitContextAttachmentWidget when there are visible implicit context values (enabled entries in Ask mode, or selections)
  • Factor implicit context presence into attachmentsContainer and attachedContextContainer visibility

Copilot AI review requested due to automatic review settings February 20, 2026 21:13
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

Updates the chat input UI so the attachments toolbar is shown not only for explicit attachments, but also when “implicit context” (active editor context in Ask mode and editor selections) is present, making that context visible and actionable from the toolbar.

Changes:

  • Adds rendering of ImplicitContextAttachmentWidget in renderAttachedContext() when implicit context values are present.
  • Updates attachments container visibility logic to consider implicit context in addition to explicit attachments.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts:2411

  • ImplicitContextAttachmentWidget mutates properties on the DOM node passed to it (e.g. sets ariaLabel/tabIndex on its domNode when rendering resources). Passing attachedContextContainer here means those attributes can be applied to the shared container that also holds explicit attachment widgets, which can introduce an unexpected tab stop and confusing screen reader output. Consider creating a dedicated child container for implicit context content and passing that element to the widget instead of the shared attachedContextContainer.
			const implicitContextWidget = this.instantiationService.createInstance(
				ImplicitContextAttachmentWidget,
				() => this._widget,
				isAttachmentAlreadyAttached,
				this._implicitContext,
				this._contextResourceLabels,
				this._attachmentModel,
				container,
			);

@daviddossett daviddossett marked this pull request as ready for review February 20, 2026 23:12
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 20, 2026
@daviddossett daviddossett removed the request for review from justschen February 20, 2026 23:20
@daviddossett daviddossett marked this pull request as draft February 20, 2026 23:32
@daviddossett daviddossett marked this pull request as ready for review February 20, 2026 23:32
@daviddossett daviddossett merged commit 175a5fd into main Feb 20, 2026
19 checks passed
@daviddossett daviddossett deleted the ddossett/scientific-catshark branch February 20, 2026 23:45
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.

2 participants