Skip to content

feat(chat): add 'Export Chat as Markdown' command#295128

Open
n24q02m wants to merge 1 commit intomicrosoft:mainfrom
n24q02m:feat/export-chat-markdown
Open

feat(chat): add 'Export Chat as Markdown' command#295128
n24q02m wants to merge 1 commit intomicrosoft:mainfrom
n24q02m:feat/export-chat-markdown

Conversation

@n24q02m
Copy link

@n24q02m n24q02m commented Feb 13, 2026

Fixes #276629

Adds a new Export Chat as Markdown command (workbench.action.chat.exportAsMarkdown) that allows users to export the current chat session as a formatted .md file.

Changes

New Action: ExportChatAsMarkdownAction

  • Command ID: workbench.action.chat.exportAsMarkdown
  • Menu locations: Command Palette (F1), Chat context menu, Chat title bar menu
  • Reuses the existing stringifyItem() utility for consistent Markdown formatting
  • Filters out system-filtered responses (same as Export JSON)
  • Opens a native Save dialog with .md filter, defaulting to a sanitized session title

Smoke Tests

  • 3 new tests verifying Export Markdown, Export JSON, and Import Chat commands are discoverable in the command palette

How It Works

The implementation follows the same pattern as the existing ExportChatAction (JSON export):

  1. Retrieves the active chat session via IChatService
  2. Iterates over requests, calling stringifyItem(request) and stringifyItem(response) to produce Markdown text
  3. Joins all items with double newlines
  4. Prompts the user with a Save dialog (.md filter)
  5. Writes the file via IFileService

Testing

  • Smoke tests: 3/3 passing
  • Unit tests: All 642 common chat tests passing (no regressions)

Add a new action 'workbench.action.chat.exportAsMarkdown' that exports
the current chat session as a formatted Markdown file (.md).

The command:
- Appears in the command palette (F1)
- Shows in the Chat context menu and Chat title bar menu
- Uses the existing stringifyItem() utility for consistent formatting
- Filters out system-filtered responses
- Opens a Save dialog with .md filter

Also adds smoke tests verifying the Export Markdown, Export JSON,
and Import Chat commands are discoverable in the command palette.

Fixes microsoft#276629
Copilot AI review requested due to automatic review settings February 13, 2026 10:44
@n24q02m
Copy link
Author

n24q02m commented Feb 13, 2026

@microsoft-github-policy-service agree

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

This PR adds a new Export Chat as Markdown command that allows users to export the current chat session as a formatted .md file, complementing the existing JSON export functionality. The implementation reuses existing markdown formatting logic for consistency with the copy commands.

Changes:

  • Added a new ExportChatAsMarkdownAction with menu placements in the chat context menu and title bar
  • Created smoke tests to verify Export Markdown, Export JSON, and Import Chat commands are discoverable
  • Reused existing stringifyItem() utility for consistent markdown formatting

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/smoke/src/main.ts Added import and setup call for new chat export markdown smoke tests
test/smoke/src/areas/chat/chatExportMarkdown.test.ts New smoke test file verifying discoverability of export/import commands
src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts Added ExportChatAsMarkdownAction with markdown export logic, imports, and menu configuration

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.

export chat as markdown

2 participants