Skip to main content

Module DebugProvider

Module DebugProvider 

Source
Expand description

DebugService: manages debug adapter protocol sessions.

§DebugProvider (Environment)

Implements DebugService for MountainEnvironment, managing the complete debugging session lifecycle from configuration to termination. Orchestrates between the extension host (Cocoon), the debug adapter, and the UI, including DAP (Debug Adapter Protocol) message mediation.

Uses two-stage registration: configuration providers and adapter descriptor factories. Each debug type (node, java, rust) can have its own configuration and adapter. Integrates with IPCProvider for RPC to Cocoon.

§Debug session flow

  1. UI calls StartDebugging with folder URI and configuration.
  2. Mountain RPCs to Cocoon to resolve debug configuration (variable substitution).
  3. Mountain RPCs to Cocoon to create debug adapter descriptor.
  4. Mountain spawns debug adapter process or connects to TCP server.
  5. Mountain mediates DAP messages between UI and debug adapter.
  6. UI sends DAP commands via SendCommand which forwards to adapter.
  7. Debug adapter sends DAP events/notifications back through Mountain to UI.
  8. Session ends on stop request or adapter process exit.

§Methods

  • RegisterDebugConfigurationProvider - register config resolver
  • RegisterDebugAdapterDescriptorFactory - register adapter factory
  • StartDebugging - start debug session
  • SendCommand - send DAP command to adapter
  • StopDebugging - graceful DAP disconnect then session unregister

§VS Code reference

  • vs/workbench/contrib/debug/browser/debugService.ts
  • vs/workbench/contrib/debug/common/debug.ts
  • vs/workbench/contrib/debug/browser/adapter/descriptorFactory.ts
  • vs/debugAdapter/common/debugProtocol.ts