Package org.eclipse.lemminx.services.extensions.format

## Interface IFormatterParticipant

All Known Implementing Classes:
  `ContentModelFormatterParticipant`, `XSIFormatterParticipant`

    public interface IFormatterParticipant

XML formatter participant.

Author:
  Angelo ZERR

### Method Summary

All Methods Instance Methods Default Methods
`default boolean` `formatAttributeValue​(String name, String valueWithoutQuote, Character quote, DOMAttr attr, XMLBuilder xml)` Format the given attribute value.
`default boolean` `formatAttributeValue​(DOMAttr attr, XMLFormatterDocument formatterDocument, XMLFormattingConstraints parentConstraints, XMLFormattingOptions formattingOptions, List<org.eclipse.lsp4j.TextEdit> edits)` Format the given attribute value.
`default FormatElementCategory` `getFormatElementCategory​(DOMElement element, XMLFormattingConstraints parentConstraints, Map<String,​Collection<CMDocument>> formattingContext, SharedSettings sharedSettings)` Returns the format element category for the given DOM element and null otherwise.
`default boolean` `shouldCollapseEmptyElement​(DOMElement element, SharedSettings sharedSettings)` Returns true if the given element can be collapsed according to grammar constraints.

### Method Detail

#### formatAttributeValue

    default boolean formatAttributeValue​(String name,
                                         String valueWithoutQuote,
                                         Character quote,
                                         DOMAttr attr,
                                         XMLBuilder xml)

Format the given attribute value.

The formatter must take care of to generate attribute value with quote.

Parameters:
  `name` - the attribute name.
  `valueWithoutQuote` - the attribute value without quote.
  `quote` - the quote and null otherwise. null quote means that the formatter must not generate a quote in the xml builder.
  `attr` - the DOM attribute and null otherwise.
  `xml` - the XML builder.
Returns:
  true if the given attribute can be formatted and false otherwise.

#### formatAttributeValue

    default boolean formatAttributeValue​(DOMAttr attr,
                                         XMLFormatterDocument formatterDocument,
                                         XMLFormattingConstraints parentConstraints,
                                         XMLFormattingOptions formattingOptions,
                                         List<org.eclipse.lsp4j.TextEdit> edits)

Format the given attribute value.

Parameters:
  `formatterDocument` - the formatter document
  `indentLevel` - the current indent level of the attribute
  `formattingOptions` - the formatting options that contain the settings
  `attr` - the attribute node
  `edits` - the text edit list
Returns:
  true if the given attribute can be formatted and false otherwise.

#### getFormatElementCategory

    default FormatElementCategory getFormatElementCategory​(DOMElement element,
                                                           XMLFormattingConstraints parentConstraints,
                                                           Map<String,​Collection<CMDocument>> formattingContext,
                                                           SharedSettings sharedSettings)

Returns the format element category for the given DOM element and null otherwise.

Parameters:
  `element` - the DOM element.
  `parentConstraints` - the parent constraints.
  `sharedSettings` - the shared settings.
Returns:
  the format element category for the given DOM element and null otherwise.

#### shouldCollapseEmptyElement

    default boolean shouldCollapseEmptyElement​(DOMElement element,
                                               SharedSettings sharedSettings)

Returns true if the given element can be collapsed according to grammar constraints.

Parameters:
  `element` - the DOM element.
  `sharedSettings` - the shared settings.
Returns:
  true if the given element can be collapsed according to grammar constraints.