Packages

package formatting

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. case class RangeFormatting(parentYPart: YPart, formattingOptions: FormattingOptions, isJson: Boolean, syntaxErrors: ErrorsCollected, raw: Option[String], initialIndentation: Int) extends Product with Serializable

Value Members

  1. object SyamlImpl

    Utility object for YAML AST formatting and reformatting operations.

    Utility object for YAML AST formatting and reformatting operations.

    Responsibility

    This object provides implicit extensions for formatting YAML AST parts with proper indentation and whitespace handling. It handles:

    • Formatting YPart elements (YDocument, YMap, YSequence, YMapEntry, YNode, YScalar, YComment)
    • Managing indentation levels during formatting
    • Handling flow vs block style YAML structures
    • Token manipulation for whitespace, line breaks, and indentation
    • Preserving comments during formatting

    Flow Style Handling

    YAML flow structures (using [] and {}) are left mostly untouched to preserve user formatting preferences. Block style structures are reformatted with proper indentation.

    Usage

    Import the implicit class to enable .format() method on YPart instances:

    import org.mulesoft.als.actions.formatting.SyamlImpl._
    val formatted = yDocument.format(indentSize = 2, currentIndentation = 0)

    Related Classes

    • org.mulesoft.als.common.edits.YamlEditBuilder - Building TextEdits for YAML modifications
    • org.mulesoft.als.common.YamlUtils - Position-based YAML navigation
    • org.yaml.render.YamlRender - SYAML's built-in rendering (used for scalar values)

Ungrouped