Skip to main content

Module render

Module render 

Source
Expand description

Rich CLI rendering for PositionalDiagnostics.

render turns one diagnostic into a styled annotate_snippets string. to_positional inspects a CliError and pulls out any positional diagnostics it carries so display_error can render rustc-quality output: caret under the offending token, file/line origin, plain help: footers, and did you mean patches that show the suggested replacement inline.

Errors that don’t carry source positions (configuration errors, network failures, etc.) return an empty Vec; the caller falls back to the plain std::fmt::Display path.

FunctionsΒ§

clamp πŸ”’
clamped_range πŸ”’
Clamp the byte range to [0, source.len()] so an out-of-bounds offset (e.g. a parser pos past EOF) doesn’t panic inside annotate-snippets.
object_typecheck_to_positional πŸ”’
origin_string πŸ”’
Render path as a snippet origin, dropping redundant ./ components so paths like ././models/foo.sql print as models/foo.sql.
parse_to_positional πŸ”’
render πŸ”’
Render a single PositionalDiagnostic to a styled string.
to_positional πŸ”’
Extract any positional diagnostics carried by error.
typecheck_to_positional πŸ”’
unresolved_variables_to_positional πŸ”’
One PositionalDiagnostic per unresolved variable, pointed at its reference in the source. The hint footer differs based on whether a profile is active: with no profile, it directs the user to set one; otherwise, it points at the profile’s [variables] table.
validation_error_to_positional πŸ”’
validation_to_positional πŸ”’