Skip to main content

Crate fatou_formatter

Crate fatou_formatter 

Source
Expand description

Deterministic, rule-based formatter for the Julia language.

This crate is the formatting engine of the fatou CLI, extracted so embedders (such as a dprint Wasm plugin) can use it without the CLI’s filesystem and process machinery. It formats a source string or an already-parsed fatou_parser CST; batch file walking, caching, and config discovery stay host-side.

§Main entry points

The crate is wasm32-unknown-unknown-compatible: no filesystem, process, thread, or clock use.

§Features

  • serde — Serialize/Deserialize for FormatStyle and LineEnding, spelled like their fatou.toml counterparts.
  • schema — additionally derives schemars::JsonSchema, so an embedder (e.g. a dprint plugin) can generate a config schema.

Re-exports§

pub use formatter::FormatError;
pub use formatter::FormatOptions;
pub use formatter::FormatStyle;
pub use formatter::LineEnding;
pub use formatter::RangeFormatted;
pub use formatter::VerifiedFormatError;
pub use formatter::format;
pub use formatter::format_node;
pub use formatter::format_node_with_options;
pub use formatter::format_range;
pub use formatter::format_range_with_options;
pub use formatter::format_verified;
pub use formatter::format_verified_with_options;
pub use formatter::format_verified_with_style;
pub use formatter::format_with_options;
pub use formatter::format_with_style;
pub use formatter::print_document;
pub use verify::VerificationError;
pub use rowan;

Modules§

formatter
The formatter: consumes the CST and produces formatted text via a Wadler/Prettier-style document IR (ir) printed by a single best-fit layout engine (printer) that makes all line-break decisions.
parser
Re-export of fatou_parser::parser so internal crate::parser paths resolve unchanged in the sources shared with the fatou CLI.
syntax
Re-export of fatou_parser::syntax so internal crate::syntax paths resolve unchanged in the sources shared with the fatou CLI.
verify
Formatting-invariant AST shape — the basis of ast(x) == ast(format(x)).