Class ContentModelFormatterParticipant
- java.lang.Object
-
- org.eclipse.lemminx.extensions.contentmodel.participants.ContentModelFormatterParticipant
-
- All Implemented Interfaces:
IFormatterParticipant
public class ContentModelFormatterParticipant extends Object implements IFormatterParticipant
Formatter participant which uses XSD/DTD grammar information to know theFormatElementCategoryof a given element.This participant is enabled when 'xml.format.grammarAwareFormatting' setting is set to true.
- Author:
- Angelo ZERR
-
-
Constructor Summary
Constructors Constructor Description ContentModelFormatterParticipant(ContentModelManager contentModelManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormatElementCategorygetFormatElementCategory(DOMElement element, XMLFormattingConstraints parentConstraints, Map<String,Collection<CMDocument>> formattingContext, SharedSettings sharedSettings)Returns the format element category for the given DOM element and null otherwise.booleanshouldCollapseEmptyElement(DOMElement element, SharedSettings sharedSettings)Returns true if the given element can be collapsed according to grammar constraints.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.lemminx.services.extensions.format.IFormatterParticipant
formatAttributeValue, formatAttributeValue
-
-
-
-
Constructor Detail
-
ContentModelFormatterParticipant
public ContentModelFormatterParticipant(ContentModelManager contentModelManager)
-
-
Method Detail
-
getFormatElementCategory
public FormatElementCategory getFormatElementCategory(DOMElement element, XMLFormattingConstraints parentConstraints, Map<String,Collection<CMDocument>> formattingContext, SharedSettings sharedSettings)
Description copied from interface:IFormatterParticipantReturns the format element category for the given DOM element and null otherwise.- Specified by:
getFormatElementCategoryin interfaceIFormatterParticipant- 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
public boolean shouldCollapseEmptyElement(DOMElement element, SharedSettings sharedSettings)
Description copied from interface:IFormatterParticipantReturns true if the given element can be collapsed according to grammar constraints.- Specified by:
shouldCollapseEmptyElementin interfaceIFormatterParticipant- Parameters:
element- the DOM element.sharedSettings- the shared settings.- Returns:
- true if the given element can be collapsed according to grammar constraints.
-
-