Attach context feature for sessions dedicated window#296120
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds file attachment functionality to the Agent Sessions window's new chat interface. Users can now attach files to their chat requests before sending them, similar to the functionality available in the standard VS Code chat interface.
Changes:
- Added file attachment UI with a "+" button to select files via quick access picker
- Implemented attachment pill rendering with remove functionality
- Passed attached context through the request flow to the chat widget
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts | Updated sendLocalSession to accept and apply attachedContext from sendOptions to the chat widget's attachment model |
| src/vs/sessions/contrib/chat/browser/newChatViewPane.ts | Added attachment UI (button, picker, pills), attachment state management, and integration with send request flow |
| src/vs/sessions/contrib/chat/browser/media/chatWidget.css | Added CSS styling for attach button, attachment container, and attachment pills |
Comments suppressed due to low confidence (2)
src/vs/sessions/contrib/chat/browser/newChatViewPane.ts:1087
- The attachedContext is being duplicated - it's included both in sendOptions.attachedContext (line 1075) and as a separate field in the data object passed to onSendRequest (line 1087). This redundancy can lead to confusion and potential bugs if the two get out of sync.
Since sendOptions already contains attachedContext and is part of INewChatSendRequestData, the separate attachedContext field at line 1087 appears unnecessary. Consider removing line 1087 to avoid this duplication.
attachedContext: this._attachedContext.length > 0 ? [...this._attachedContext] : undefined,
};
const folderUri = this._selectedFolderUri ?? this.workspaceContextService.getWorkspace().folders[0]?.uri;
this._options.onSendRequest?.({
resource,
target,
query,
sendOptions,
selectedOptions: new Map(this._selectedOptions),
folderUri,
attachedContext: this._attachedContext.length > 0 ? [...this._attachedContext] : undefined,
src/vs/sessions/contrib/chat/browser/newChatViewPane.ts:546
- The remove button is missing keyboard support. While tabIndex and role are set, there's no KEY_DOWN event listener to handle Enter or Space key presses for users navigating via keyboard.
Add a keyboard event listener similar to the click handler to support accessibility, e.g., dom.addDisposableListener(removeButton, dom.EventType.KEY_DOWN, (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); this._removeAttachment(entry.id); } }).
const removeButton = dom.append(pill, dom.$('.sessions-chat-attachment-remove'));
removeButton.title = localize('removeAttachment', "Remove");
removeButton.tabIndex = 0;
removeButton.role = 'button';
dom.append(removeButton, renderIcon(Codicon.close));
this._register(dom.addDisposableListener(removeButton, dom.EventType.CLICK, (e) => {
e.stopPropagation();
this._removeAttachment(entry.id);
}));
… picker functionality
…ent management for new chat widget
…n context attachments
Removed filesView section from LAYOUT.md
Removed import for filesView contribution.
No description provided.