/**
* Pretty-printer for diagnostics.
*
* Output style is modelled after the Rust compiler / TypeScript diagnostic
* block: a header with severity and message, a `-->` location line, the
* offending source line with a caret underline, and optional hint/note
* trailers. The goal is that a user pasting a single error block into
* a chat or an issue gives enough context to be actionable on its own.
*
* Example output:
*
* error: unknown template path "person.male.first_name"
* --> demo.xml:17:31
* |
* 17 |
* | ^^^^^^^^^^^^^^^^^^^^^^
* |
* help: did you mean "person.male.firstName"?
* note: known paths: person.male.firstName, person.female.firstName, ...
*
* Multi-diagnostic input is printed as a series of blocks separated by
* blank lines, terminated with a summary count.
*/
import type { Diagnostic } from './diagnostic.js';
export interface FormatOptions {
/**
* One line per diagnostic, with no source excerpt and no carets.
*
* The full report is right for a person and wrong for a program: 1746
* characters and 27 lines for three errors, of which three lines carry the
* finding and the rest draw a picture of the file. A tool feeding a refusal
* back to a model spends two thirds of its window on that picture, and an
* editor listing errors in a panel wants rows, not art.
*
* TDC010 3:12 unknown child of : "" :: Allowed inside …
*/
readonly brief?: boolean;
/**
* Filename to print in the `-->` location prefix. Defaults to
* `` so single-file CLI invocations read naturally even when
* the user passed a string, not a path.
*/
readonly filename?: string;
/**
* Enable ANSI colouring. Off by default — the renderer has no easy
* way to know whether stderr is a TTY; the CLI layer enables it.
*/
readonly colors?: boolean;
}
/**
* Format a single diagnostic. `source` is the original DSL text, used
* to render the offending line with a caret. If `source` is omitted
* (e.g. a diagnostic carrying no location context), only the header is
* printed.
*/
export declare function formatDiagnostic(d: Diagnostic, source?: string, options?: FormatOptions): string;
/**
* Format multiple diagnostics as a report. Adds a blank line between
* each diagnostic block and a terminal summary counting errors and
* warnings. Returns the empty string if no diagnostics are given.
*/
export declare function formatDiagnostics(diagnostics: readonly Diagnostic[], source?: string, options?: FormatOptions): string;
//# sourceMappingURL=format.d.ts.map