Skip to main content

Crate teksilo_fmt

Crate teksilo_fmt 

Source
Expand description

Formatter for the teksu! DSL.

Pure library — the CLI lives in cargo-teksilo-fmt. Two entry points:

  • format_block — format the body of a single teksu!(...) macro invocation. Input is the contents inside the parens, including any ctx => preamble.
  • format_file — format every teksu!(...) invocation in a Rust source file. Returns the full file content with each macro body replaced by its formatted form. Source outside teksu! blocks is untouched.

Comments and blank lines between body items are preserved via a byte-range trivia pass over the original source. Rust expressions embedded in the DSL (positional args, property values, escape exprs, etc.) are sliced verbatim from source — preserving any user formatting inside them.

Structs§

FmtConfig
Formatter configuration. Empty in v1; reserved for future style knobs.
TeksiMacroEdit
Trivia

Enums§

FmtError
Errors produced by the formatter.
TriviaKind

Functions§

find_teksilo_macros
format_block
Format the body of a single teksu!(...) invocation.
format_file
Format every teksu!(...) invocation in a Rust source file.
reindent_block
Re-indent a formatted block so its outermost } lands at the same column the user already had in source (see visit::observed_body_indent). The formatter emits with column-0 indents internally; this shifts every line except the first by base_indent spaces. Newlines emitted by the formatter remain \n-only — line-ending normalization (LF↔CRLF) is the caller’s responsibility.
scan_trivia
Scan source for trivia between tokens of tokens. Returned vec is sorted by ascending offset.