Skip to content

Issue: [Feature Request] Add "Export Chat History" Functionality #256366

@Muneerali199

Description

@Muneerali199

Problem Statement

Currently, all Copilot Chat conversations are ephemeral—users lose valuable context when:

  • Restarting VS Code
  • Switching workspaces
  • System crashes occur

This is problematic for:

  • ✅ Debugging – Can’t reference past AI suggestions
  • ✅ Learning – Losing explanations of complex code
  • ✅ Collaboration – No way to share chat threads with teammates

Proposed Solution

Add an "Export Chat" button in the chat panel that saves conversations to disk in a readable format.

UI/UX Flow

Button Placement:

  • Location: Next to "Clear Chat" (or in chat panel header)
  • Icon: ⬇️ or 📁 (consistent with VS Code’s export metaphors)
  • Tooltip: "Export full chat history"

Export Behavior:

  • File Format: .md (Markdown) for rich formatting + code blocks
  • Default Filename: copilot_chat_{timestamp}.md
  • Save Location: Open VS Code’s native file dialog (vscode.window.showSaveDialog)

Technical Implementation

// 1. Register command in package.json
"contributes": {
  "commands": [{
    "command": "copilot-chat.exportHistory",
    "title": "Export Chat History"
  }]
}
// 2. Core export logic
const exportChat = async () => {
  const messages = getChatHistory(); // Array of {role, content, timestamp}
  const markdownContent = messages.map(msg => 
    `**${msg.timestamp} [${msg.role}]**\n${msg.content}`
  ).join('\n\n---\n\n');

  const uri = await vscode.window.showSaveDialog({
    filters: { 'Markdown': ['md'] },
    defaultUri: vscode.Uri.file(`copilot_chat_${Date.now()}.md`)
  });
  
  if (uri) {
    await vscode.workspace.fs.writeFile(
      uri, 
      new TextEncoder().encode(markdownContent)
    );
  }
};

This feature would greatly enhance Copilot Chat usability by allowing users to save, reference, and share their AI conversations.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions