Skip to content

Instantly share code, notes, and snippets.

@timheuer
Last active July 22, 2025 20:10
Show Gist options
  • Save timheuer/662e08b260e8d41772d7c7e0ad920c4f to your computer and use it in GitHub Desktop.
Save timheuer/662e08b260e8d41772d7c7e0ad920c4f to your computer and use it in GitHub Desktop.
Additional Extension Data for VS Code Issue Reporter

Implementing Issue Reporter Functionality in a VS Code Extension

This guide explains how to add an issue reporter feature to your VS Code extension, allowing users to easily report issues with relevant log output attached. It covers command registration, menu contributions, and the command callback implementation, with code snippets for each step.

NOTE: This example uses logTester as the extension name, but this would be your extension id.

1. Command Registration

Add a new command to your extension's package.json to register the issue reporter command:

// package.json
"contributes": {
  "commands": [
    {
      "command": "logTester.reportIssue",
      "title": "Log Tester: Report Issue"
    }
  ]
}

When users invoke this command it will launch the Issue Reporter pre-filled with the extension ID selected.

2. Menu Contributions

To make the command accessible from the Command Palette and Issue Reporter, add it to the menus section:

// package.json
"contributes": {
  "menus": {
    "commandPalette": [
      {
        "command": "logTester.reportIssue",
        "when": "true"
      }
    ],
    "issue/reporter": [
      {
        "command": "logTester.reportIssue"
      }
    ]
  }
}

3. Command Callback Implementation

In your extension's main file (e.g., src/extension.ts), implement the command callback. This example collects log output and opens the issue reporter:

// src/extension.ts
import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
  // ...existing code...

  const reportIssueCommand = vscode.commands.registerCommand('logTester.reportIssue', async () => {
    // Get whatever data you may want to add like log outputs or anything
    const logOutput = '...collect log output here...';

    // This will wrap it nicely for a GitHub issue in a collapsable section
    const wrappedLog = `<details><summary>Log Output</summary><pre>${logOutput}</pre></details>`;

    // Open the issue reporter with log output attached
    await vscode.commands.executeCommand('vscode.openIssueReporter', {
      extensionId: 'your-publisher-name.your-extension-id',
      data: wrappedLog
    });
  });

  context.subscriptions.push(reportIssueCommand);

  // ...existing code...
}

4. Summary

With these steps, your extension will provide a convenient way for users to report issues with relevant log output included, improving diagnostics and support. This will provide Additional Extension Info automatically (with the ability for the user to unselect that before submitting):

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment