Skip to main content

Module formatter

Module formatter 

Source

Structs§

FormatDriver
Driver that writes the syntax tree to a string by visiting tokens. You can use [format] directly, or build a custom flow with walk(root, &mut driver, &opts).
FormatterOptions
Options for printing the syntax tree.

Enums§

BraceStyle
Brace placement for blocks.
IndentStyle
Indentation style for canonical formatting.
SemicolonStyle
Semicolon style for statement ends.

Functions§

format
Print the syntax tree to a string. When canonical_format, parenthesize_expressions, or annotate_types is set, runs a custom walk; otherwise uses sipha’s emit API for round-trip.
load_formatter_options_from_dir
Try to load formatter options from a directory: first .leekfmt.toml, then leekscript.toml with [format] section. Returns None if no file is found or parsing fails; caller falls back to FormatterOptions::default().
load_formatter_options_from_file
Load formatter options from a single config file (e.g. .leekfmt.toml) with a top-level [format] section.