Skip to content

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

TypeKindSummarySource
CommentReinserterclassReinserts standalone // comment lines into formatted output.source
EditorConfigFormattingOptionsResolverclassDerives FormattingOptions for a file by reading the .editorconfig chain above it, honoring indent_style, indent_size, tab_width, and end_of_line.source
FormatterclassThe canonical source formatter: renders a parsed Program or Expr back to Ashes source text in the one canonical layout.source
FormattingOptionsrecord structThe 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.

MemberSignatureSummary
Formatstring Format(Program program)Formats a whole program with default options and no pipeline rewriting.
Formatstring Format(Program program, FormattingOptions options)Formats a whole program using the given whitespace options, with no pipeline rewriting.
Formatstring 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.
Formatstring Format(Expr expr)Formats a single expr with default options and no pipeline rewriting.
Formatstring Format(Expr expr, FormattingOptions options)Formats a single expr using the given whitespace options, with no pipeline rewriting.
Formatstring 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.

MemberSignatureSummary
IndentSizeint IndentSizeNumber of columns per indentation level. Defaults to 4.
NewLinestring NewLineThe line ending appended between lines, either "\n" or "\r\n". Defaults to "\n".
NormalizeFormattingOptions 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".
UseTabsbool UseTabsWhen true, indentation is emitted with tab characters instead of spaces.