Skip to main content

Module DiagnosticProvider

Module DiagnosticProvider 

Source
Expand description

DiagnosticManager: collects and publishes editor diagnostic markers.

§DiagnosticProvider (Environment)

Implements the DiagnosticManager trait, managing diagnostic information from multiple sources (language servers, extensions, built-in providers). It aggregates diagnostics by owner, file URI, and severity, and notifies the UI when changes occur.

Diagnostics are stored in ApplicationState.Feature.Diagnostics as a nested HashMap<owner, HashMap<uri, Vec<MarkerDataDTO>>>. Each owner (e.g. "typescript", "rust-analyzer") manages its collection independently.

§Data model

Each MarkerDataDTO carries:

  • Severity - Error(8), Warning(4), Information(2), Hint(1)
  • Message - human-readable description
  • StartLineNumber / StartColumn - 1-based (Cocoon’s NormaliseDiagnostic adds +1)
  • EndLineNumber / EndColumn - 1-based, same convention
  • Source - diagnostic source string (e.g. "tslint")
  • Code - diagnostic code for quick-fix lookup
  • ModelVersionIdentifier - document version for change tracking

§Notification flow

  1. Language server or extension calls SetDiagnostics(owner, entries).
  2. Provider validates and stores in ApplicationState.Feature.Diagnostics.
  3. Provider identifies which URIs changed in this update.
  4. Provider emits sky://diagnostics/changed with owner, uris (string array for back-compat), and changedURIs (per-URI marker payload for the SkyBridge marker bridge).
  5. Sky receives the event and updates squiggles and the Problems panel.

§VS Code reference

  • vs/workbench/services/diagnostic/common/diagnosticCollection.ts
  • vs/platform/diagnostics/common/diagnostics.ts
  • vs/workbench/services/diagnostic/common/diagnosticService.ts