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.
Formatstring Format(Program program, FormattingOptions? options)Formats a whole program. options selects the whitespace conventions; null uses the defaults.
Formatstring Format(Expr expr)Formats a single expr with default options.
Formatstring Format(Expr expr, FormattingOptions? options)Formats a single expr. 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".
PreferPipelinesbool PreferPipelinesWhen true, a chain of two or more nested calls is written as a |> pipeline. Off by default: a call written as a call stays a call, and only a pipeline written as one is laid out as a pipeline.
UseTabsbool UseTabsWhen true, indentation is emitted with tab characters instead of spaces.