Logo fantomas

WriterEvent Type

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

Union cases

Union case Description

IndentBy indent

Full Usage: IndentBy indent

Parameters:
    indent : int

Increase indentation by the given number of spaces. Takes effect on the next newline.

indent : int

NodeEnd(endNodeType, endRange)

Full Usage: NodeEnd(endNodeType, endRange)

Parameters:

Diagnostic marker: end of an Oak node. Only emitted when DebugMode is enabled.

endNodeType : string
endRange : string

NodeStart(nodeType, range)

Full Usage: NodeStart(nodeType, range)

Parameters:

Diagnostic marker: beginning of an Oak node. Only emitted when DebugMode is enabled.

nodeType : string
range : string

Placeholder

Full Usage: Placeholder

Placeholder separator between items in a colWithNlnWhenItemIsMultiline block. After all items are emitted, each Placeholder is inspected to determine if the item that follows it was multiline, and then replaced with the appropriate separator. No-op during WriterModel.update and dump.

RestoreAtColumn restoreAtColumn

Full Usage: RestoreAtColumn restoreAtColumn

Parameters:
    restoreAtColumn : int

Restore AtColumn to a previously saved value.

restoreAtColumn : int

RestoreIndent restoreIndent

Full Usage: RestoreIndent restoreIndent

Parameters:
    restoreIndent : int

Restore indentation to a previously saved value.

restoreIndent : int

SetAtColumn setAtColumn

Full Usage: SetAtColumn setAtColumn

Parameters:
    setAtColumn : int

Set the AtColumn value — the minimum indentation floor for subsequent newlines.

setAtColumn : int

SetIndent setIndent

Full Usage: SetIndent setIndent

Parameters:
    setIndent : int

Set indentation to an absolute column position.

setIndent : int

Start

Full Usage: Start

Marks the beginning of a colWithNlnWhenItemIsMultiline block. No-op during WriterModel.update and dump — used only as a DLL position marker.

UnIndentBy unindent

Full Usage: UnIndentBy unindent

Parameters:
    unindent : int

Decrease indentation by the given number of spaces.

unindent : int

Write text

Full Usage: Write text

Parameters:

Append literal text to the current line.

text : string

WriteBeforeNewline content

Full Usage: WriteBeforeNewline content

Parameters:

Queue text to be appended just before the next newline (e.g. trailing line comments).

content : string

WriteLine

Full Usage: WriteLine

End the current line and start a new one at the current indentation level.

WriteLineBecauseOfTrivia

Full Usage: WriteLineBecauseOfTrivia

Newline introduced by trivia (comments, directives) rather than by the formatter itself. Distinguished from WriteLine so colWithNlnWhenItemIsMultiline can ignore trivia-induced newlines.

WriteLineInsideStringConst

Full Usage: WriteLineInsideStringConst

Newline inside a multiline string constant — no indentation is applied.

WriteLineInsideTrivia

Full Usage: WriteLineInsideTrivia

Newline inside a trivia block (e.g. inside a block comment or directive).

WriteTrivia trivia

Full Usage: WriteTrivia trivia

Parameters:

Emit text that originated from trivia (comments, XML doc lines, or compiler directives). Behaves identically to Write in dump output, but allows the formatting engine to recognise trivia events without fragile string-prefix checks (e.g. "starts with //").

trivia : string

Type something to start searching.