Skip to content

feat(config): add Visual Studio options page generator #17

@CalvinAllen

Description

@CalvinAllen

Summary

Provide a helper or source generator to automatically create a Visual Studio Options page for telemetry configuration. Allows users to configure telemetry settings through the standard VS Options dialog.

Current State

Extensions must manually create an Options page to let users configure telemetry, requiring:

  • DialogPage subclass
  • Registration attributes
  • Property grid setup
  • Settings persistence

Proposed Solution

Option 1: Base Class

// Inherit from provided base class
[Guid("...")]
public class MyTelemetryOptionsPage : TelemetryOptionsPageBase
{
    // Automatically provides UI for:
    // - Enable/disable telemetry
    // - OTLP endpoint configuration  
    // - Console exporter toggle
    // - Sampling rate
    // - Custom endpoint headers
    
    // Override to add extension-specific options
    protected override void AddCustomOptions(PropertyGrid grid)
    {
        // Add your own settings
    }
}

Option 2: Source Generator

// Attribute triggers generation
[GenerateTelemetryOptionsPage]
public partial class MyExtensionPackage : AsyncPackage
{
    // Options page automatically generated and registered
}

Option 3: Runtime Registration

// In package initialization
VsixTelemetry.RegisterOptionsPage(this, new TelemetryOptionsConfig
{
    PageName = "My Extension Telemetry",
    Category = "My Extension",
    AllowEndpointConfiguration = true,
    AllowSamplingConfiguration = true
});

Generated UI

The options page would include:

  • Enable Telemetry (checkbox)
  • OTLP Endpoint (text field, validated URL)
  • Use HTTP (checkbox, vs gRPC)
  • Sampling Rate (slider 0-100%)
  • Enable Console Output (checkbox, for debugging)
  • Custom Headers (key-value grid)

Benefits

  • Consistent telemetry UI across extensions
  • Reduces boilerplate significantly
  • Users get familiar settings location
  • Settings automatically persisted

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions