Packages

o

org.mulesoft.als.common.edits

YamlEditBuilder

object YamlEditBuilder

Utility object for building LSP TextEdits from YAML/JSON AST modifications.

Responsibility

This object is responsible for creating TextEdit instances that represent modifications to YAML or JSON documents. It handles:

  • Updating existing scalar values
  • Creating new property entries with proper formatting
  • Removing entries (including multi-line content)
  • Finding entries by key name
  • Calculating indentation and insertion positions
  • Formatting scalar values with proper quoting for YAML/JSON

Usage

This utility is designed to be reusable across different editing operations such as setNodeProperties, setGraph, and other YAML modification features.

Line Indexing

SYAML uses 1-indexed line numbers while LSP uses 0-indexed. This object handles the conversion internally using AmfPosition and Position classes.

Related Classes

  • org.mulesoft.als.common.YamlUtils - Position-based YAML navigation and queries
  • org.mulesoft.als.actions.formatting.SyamlImpl - YAML formatting/reformatting
  • org.mulesoft.als.common.YPartBranch - AST branch context and navigation
See also

org.mulesoft.lsp.edit.TextEdit

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. YamlEditBuilder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  6. def createScalarEntry(key: String, value: String, indentation: Int, isJsonFormat: Boolean): String

    Create a new property entry to be inserted into a YMap.

    Create a new property entry to be inserted into a YMap. Builds a YMapEntry and renders it using SYAML for proper escaping and formatting.

    key

    The property key

    value

    The scalar value

    indentation

    The indentation level (number of spaces)

    isJsonFormat

    Whether the document is JSON format

    returns

    The formatted string for the new entry

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def findEntry(yMap: YMap, key: String): Option[YMapEntry]

    Find a YMapEntry by key name within a YMap.

    Find a YMapEntry by key name within a YMap.

    yMap

    The YMap to search

    key

    The key name to find

    returns

    The YMapEntry if found

  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  11. def getEntryIndentation(entry: YMapEntry): Int

    Get the indentation of a YMapEntry (column position of the key).

    Get the indentation of a YMapEntry (column position of the key).

    entry

    The YMapEntry

    returns

    The indentation in spaces (0-indexed column position)

  12. def getInsertPosition(yMap: YMap): Range

    Get the position to insert a new entry at the end of a YMap.

    Get the position to insert a new entry at the end of a YMap.

    yMap

    The YMap to insert into

    returns

    LSP Range representing the insertion point

  13. def getMapIndentation(yMap: YMap): Int

    Get the indentation for entries within a YMap based on existing entries.

    Get the indentation for entries within a YMap based on existing entries.

    yMap

    The YMap

    returns

    The indentation in spaces, or 0 if no entries exist

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  19. def removeEntry(entry: YMapEntry, parentMap: Option[YMap] = None): TextEdit

    Remove a property entry from a YMap.

    Remove a property entry from a YMap. Returns a TextEdit that removes the entire entry including nested content. For multi-line entries (objects, arrays), this calculates the full extent by examining nested content.

    entry

    The YMapEntry to remove

    parentMap

    Optional parent YMap to find next sibling for accurate end calculation

    returns

    TextEdit to remove the entry

  20. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. def updateScalarValue(entry: YMapEntry, newValue: String, isJsonFormat: Boolean): TextEdit

    Update a scalar value within a YMapEntry.

    Update a scalar value within a YMapEntry. Returns a TextEdit that replaces just the value portion.

    entry

    The YMapEntry containing the property

    newValue

    The new scalar value

    isJsonFormat

    Whether the document is JSON format

    returns

    TextEdit to apply the change

  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped