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 singleteksu!(...)macro invocation. Input is the contents inside the parens, including anyctx =>preamble.format_file— format everyteksu!(...)invocation in a Rust source file. Returns the full file content with each macro body replaced by its formatted form. Source outsideteksu!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.
- Teksi
Macro Edit - Trivia
Enums§
- FmtError
- Errors produced by the formatter.
- Trivia
Kind
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 (seevisit::observed_body_indent). The formatter emits with column-0 indents internally; this shifts every line except the first bybase_indentspaces. Newlines emitted by the formatter remain\n-only — line-ending normalization (LF↔CRLF) is the caller’s responsibility. - scan_
trivia - Scan
sourcefor trivia between tokens oftokens. Returned vec is sorted by ascending offset.