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 queriesorg.mulesoft.als.actions.formatting.SyamlImpl- YAML formatting/reformattingorg.mulesoft.als.common.YPartBranch- AST branch context and navigation
- See also
org.mulesoft.lsp.edit.TextEdit
- Alphabetic
- By Inheritance
- YamlEditBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
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
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
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)
-
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
-
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
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated