Skip to main content

Crate arity_formatter

Crate arity_formatter 

Source
Expand description

Deterministic, rule-based formatter for the R language.

This crate is the formatting engine of arity, extracted so that other tools (e.g. a dprint plugin) can embed it. Output is decided solely by the formatter’s rules and its best-fit layout engine; the input’s existing line breaks never influence the result. The target style is the tidyverse R style guide.

The primary entry points are [format] and format_with_style, configured via FormatStyle. Their format_verified counterparts additionally check normalized syntax, ordinary comments, and idempotence. With the serde feature, FormatStyle is (de)serializable; the schema feature additionally derives schemars::JsonSchema.

A package’s DESCRIPTION is a second grammar with its own entry point, format_description; see formatter::description.

Re-exports§

pub use formatter::DeclineReason;
pub use formatter::DescriptionFormatError;
pub use formatter::FormatAnalysis;
pub use formatter::FormatError;
pub use formatter::FormatStyle;
pub use formatter::FormatVerificationError;
pub use formatter::LineEnding;
pub use formatter::RangeFormatted;
pub use formatter::analyze_format_with_options;
pub use formatter::format;
pub use formatter::format_description;
pub use formatter::format_description_with_style;
pub use formatter::format_node;
pub use formatter::format_range;
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 rowan;

Modules§

ast
Re-export of arity_parser::ast so internal crate::ast paths resolve.
dcf
Re-export of arity_parser::dcf, the second grammar, so crate::dcf paths resolve here the way crate::parser and crate::syntax already do.
formatter
parser
Re-export of arity_parser::parser so internal crate::parser paths resolve.
syntax
Re-export of arity_parser::syntax so internal crate::syntax paths resolve.