Logo fantomas

Fantomas.Core Namespace

Type/Module Description

AssemblyVersionInformation

ASTTransformer

Async

CodeFormatter

CodeFormatterImpl

CodePrinter

Context

The helpers in this module are illustrated, with the events they emit and the code they produce, in src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs. Read that file before this one.

Continuation

DefineCombination

One set of defines the source is parsed and formatted under, such as `[ "DEBUG"; "NET" ]`. A file with conditional directives is formatted once per combination and the results merged, see `MultipleDefineCombinations`.

DefineParseException

Raised when one or more conditional compilation define combinations produce invalid syntax trees.

Defines

EndOfLineStyle

EventList

Mutable doubly-linked list of WriterEvents. Supports O(1) append, insert, remove, and truncation.

EventNode

A node in the mutable doubly-linked list of WriterEvents. We use [] instead of option for Prev/Next links because this is a hot path — every formatting operation appends nodes. Option would allocate a Some wrapper on every link assignment, adding GC pressure for no functional benefit. The null checks are contained within EventList's methods; callers work with non-null EventNode references returned by Append/InsertAfter/InsertBefore.

FormatConfig

FormatException

Raised when Fantomas encounters a problem during formatting.

FormatResult

InvariantViolationException

Raised when Fantomas reaches a state that its own model says is impossible, for example a chain whose parts do not fit the shape the transformer guarantees. Unlike the other exceptions here, this never indicates a problem with the code being formatted: it is a bug in Fantomas, or a change in how the F# parser groups expressions. Failing loudly is deliberate — the alternative is silently dropping parts of the source.

List

MultilineBracketStyle

MultilineFormatterType

MultipleDefineCombinations

Num

ParseException

Raised when the F# parser produces errors for source code without conditional directives.

Queue

Queue<'T>

append only collection optimized for quick append of block of data and query operations data - list of blocks in reverse order

RangeHelpers

RangePatterns

Split the range of a node into the ranges of the tokens that delimit it, so the transformer can give an opening or closing token a `SingleTextNode` of its own. `size` is the length of the token in characters: 1 for `(`, 2 for `[|` or `{|`. The ranges are computed from the ends of the node's range, not looked up, so they are only right when the token really is the first or last thing in the node.

Selection

String

SyntaxOak

Trivia

UnionCase

Validation

ValidationResult

What Fantomas made of a piece of F# source when it was asked whether that source is valid. The verdict and the reason for it together, because a caller that has to tell somebody why cannot reconstruct it from a boolean, and asking twice would parse the source twice.

Version

WriterEvent

Represents a single event emitted during the code formatting process. The sequence of writer events captures how the formatter produces its output.

Type something to start searching.