Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

Extensions can now push a hidden ChatResponseClearWidgetPart to trigger chat widget clearing, useful for showing clean final results after intermediate progress messages.

Changes

Core Types

  • chatService.ts: Added IChatClearWidget interface (kind: 'clearWidget')
  • chatModel.ts: Integrated into IChatProgressResponseContent, excluded from history via nonHistoryKinds, ignored in text representation

Extension API

  • vscode.d.ts: Exposed ChatResponseClearWidgetPart class
  • extHostTypes.ts: Implemented API class
  • extHost.protocol.ts: Added IChatClearWidgetDto for RPC
  • extHostTypeConverters.ts: Added bidirectional conversion logic

Rendering

  • chatListRenderer.ts: Added renderClearWidget() that retrieves widget via chatWidgetService.getWidgetBySessionResource() and calls widget.clear() asynchronously

Testing

  • chatModel.test.ts: Verified clearWidget is ignored in response representation

Usage

const handler: vscode.ChatRequestHandler = async (request, context, stream, token) => {
    stream.markdown('Processing...');
    await performWork();
    
    // Clear intermediate messages
    stream.push(new vscode.ChatResponseClearWidgetPart());
    
    stream.markdown('# Final Results');
    return { metadata: {} };
};

The part renders nothing visible but triggers widget clearing when processed by the renderer.

Original prompt

Introduce a new 'hidden' chat part that extensions can push which tells the renderer (vscode) to clear the chat widget

Created from VS Code.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 12, 2025 18:21
Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add hidden chat part to clear chat widget Add ChatResponseClearWidgetPart to enable programmatic widget clearing Dec 12, 2025
Copilot AI requested a review from joshspicer December 12, 2025 18:32
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