Class XSIFormatterParticipant
- java.lang.Object
-
- org.eclipse.lemminx.extensions.xsi.participants.XSIFormatterParticipant
-
- All Implemented Interfaces:
IFormatterParticipant
public class XSIFormatterParticipant extends Object implements IFormatterParticipant
Formatter participant implementation to format xsi:schemaLocation attribute value. The format of the xsi:schemaLocation attribute value depends on theXSISchemaLocationSplitsetting:XSISchemaLocationSplit.none: don't format the xsi:schemaLocation attribute value.XSISchemaLocationSplit.onElement: generate a line feed for each namespace declaration:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">XSISchemaLocationSplit.onPair: generate a line feed for each location declaration:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
- Author:
- Angelo ZERR
-
-
Constructor Summary
Constructors Constructor Description XSIFormatterParticipant()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanformatAttributeValue(String name, String valueWithoutQuote, Character quote, DOMAttr attr, XMLBuilder xml)Format the given attribute value.booleanformatAttributeValue(DOMAttr attr, XMLFormatterDocument formatterDocument, XMLFormattingConstraints parentConstraints, XMLFormattingOptions formattingOptions, List<org.eclipse.lsp4j.TextEdit> edits)Format the given attribute value.StringgetCurrentLineIndent(XMLBuilder xml, boolean insertSpaces, int tabSize)-
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
getFormatElementCategory, shouldCollapseEmptyElement
-
-
-
-
Method Detail
-
formatAttributeValue
public boolean formatAttributeValue(String name, String valueWithoutQuote, Character quote, DOMAttr attr, XMLBuilder xml)
Description copied from interface:IFormatterParticipantFormat the given attribute value.The formatter must take care of to generate attribute value with quote.
- Specified by:
formatAttributeValuein interfaceIFormatterParticipant- 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.
-
getCurrentLineIndent
public String getCurrentLineIndent(XMLBuilder xml, boolean insertSpaces, int tabSize)
-
formatAttributeValue
public boolean formatAttributeValue(DOMAttr attr, XMLFormatterDocument formatterDocument, XMLFormattingConstraints parentConstraints, XMLFormattingOptions formattingOptions, List<org.eclipse.lsp4j.TextEdit> edits)
Description copied from interface:IFormatterParticipantFormat the given attribute value.- Specified by:
formatAttributeValuein interfaceIFormatterParticipant- Parameters:
attr- the attribute nodeformatterDocument- the formatter documentformattingOptions- the formatting options that contain the settingsedits- the text edit list- Returns:
- true if the given attribute can be formatted and false otherwise.
-
-