Formatter API Reference
Generated from the /// XML doc comments in src/Ashes.Formatter/. See the Compilation Pipeline for how this project fits into the compiler. This page is regenerated by tools/docs-api-gen on every docs build — edit the doc comments in the source, not this file.
Types
| Type | Kind | Summary | Source |
|---|---|---|---|
CommentReinserter | class | Reinserts standalone // comment lines into formatted output. | source |
EditorConfigFormattingOptionsResolver | class | Derives FormattingOptions for a file by reading the .editorconfig chain above it, honoring indent_style, indent_size, tab_width, and end_of_line. | source |
Formatter | class | The canonical source formatter: renders a parsed Program or Expr back to Ashes source text in the one canonical layout. | source |
FormattingOptions | record struct | The whitespace conventions the Formatter emits with: indent width, tabs versus spaces, and line ending. | source |
Formatter
The canonical source formatter: renders a parsed Program or Expr back to Ashes source text in the one canonical layout. Because the AST carries no trivia, standalone comments are reattached separately by CommentReinserter.
| Member | Signature | Summary |
|---|---|---|
Format | string Format(Program program) | Formats a whole program with default options and no pipeline rewriting. |
Format | string Format(Program program, FormattingOptions options) | Formats a whole program using the given whitespace options, with no pipeline rewriting. |
Format | string Format(Program program, bool preferPipelines, FormattingOptions? options = null) | Formats a whole program. When preferPipelines is true, eligible call/pipe chains render as multiline |> pipelines. options selects the whitespace conventions; null uses the defaults. |
Format | string Format(Expr expr) | Formats a single expr with default options and no pipeline rewriting. |
Format | string Format(Expr expr, FormattingOptions options) | Formats a single expr using the given whitespace options, with no pipeline rewriting. |
Format | string Format(Expr expr, bool preferPipelines, FormattingOptions? options = null) | Formats a single expr. When preferPipelines is true, eligible call/pipe chains render as multiline |> pipelines. options selects the whitespace conventions; null uses the defaults. |
FormattingOptions
The whitespace conventions the Formatter emits with: indent width, tabs versus spaces, and line ending. Resolved from an .editorconfig chain by EditorConfigFormattingOptionsResolver, or constructed directly for defaults.
| Member | Signature | Summary |
|---|---|---|
IndentSize | int IndentSize | Number of columns per indentation level. Defaults to 4. |
NewLine | string NewLine | The line ending appended between lines, either "\n" or "\r\n". Defaults to "\n". |
Normalize | FormattingOptions Normalize() | Returns a copy with any out-of-range values replaced by defaults: a non-positive IndentSize becomes 4, and a NewLine other than "\n" or "\r\n" becomes "\n". |
UseTabs | bool UseTabs | When true, indentation is emitted with tab characters instead of spaces. |
