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
pathas a snippet origin, dropping redundant./components so paths like././models/foo.sqlprint asmodels/foo.sql. - parse_
to_ πpositional - render π
- Render a single
PositionalDiagnosticto a styled string. - to_
positional π - Extract any positional diagnostics carried by
error. - typecheck_
to_ πpositional - unresolved_
variables_ πto_ positional - One
PositionalDiagnosticper 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