Files
Boshen 621808eb31 perf(diagnostics): measure graphemes lazily (#25723)
Lazily measure non-ASCII graphemes instead of allocating an eager
boundary table.

Criterion single_unicode_tab: 1.1575 µs → 596.36 ns (-48.6%). ASCII
cases remain neutral or better. Kibana output is unchanged; end-to-end
performance is neutral without type-aware linting.

AI-assisted.
2026-08-16 19:06:18 +08:00
..

Oxc Diagnostics

Error reporting and diagnostic utilities for JavaScript and TypeScript tooling.

Overview

This crate provides comprehensive error handling and diagnostic reporting capabilities for JavaScript and TypeScript tooling.

Key Features

  • Rich diagnostics: Detailed error messages with source context
  • Source highlighting: Syntax-highlighted error locations
  • Multiple error support: Collect and report multiple errors at once
  • Built-in renderers: Graphical terminal and machine-readable JSON output
  • Severity levels: Support for errors, warnings, and informational messages

Architecture

Diagnostic Components

  • Message: Primary error/warning description
  • Labels: Highlight specific source locations
  • Help text: Suggestions for fixing the issue
  • Source context: Display relevant source code sections

Error Flow

  1. Creation: Tools create OxcDiagnostic instances for problems
  2. Collection: DiagnosticService aggregates diagnostics
  3. Formatting: Rich terminal output with colors and context
  4. Reporting: Display to users in IDE, CLI, or other interfaces

The diagnostic system ensures consistent, high-quality error reporting across all oxc tools.