Documentation
¶
Overview ¶
Package formatter implements a deterministic, comment-preserving TypeRB printer. Parsing happens first; the printer then uses the lossless token stream so comments, strings, percent literals, and heredocs are never lost.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(source []byte) ([]byte, []diagnostic.Diagnostic)
func FormatWithOptions ¶ added in v0.3.9
func FormatWithOptions(source []byte, options Options) ([]byte, []diagnostic.Diagnostic)
func NextLineIndent ¶ added in v0.3.17
NextLineIndent returns the indentation for a new line following a tokenizable, possibly incomplete source fragment.
func ReindentPartial ¶ added in v0.3.17
ReindentPartial applies canonical leading indentation to a tokenizable source fragment without requiring the fragment to parse as a complete program. It preserves all non-leading text and the contents of multiline tokens so an interactive editor can safely call it while a submission is still open.
Types ¶
Click to show internal directories.
Click to hide internal directories.