Package org.eclipse.lemminx.settings
Class XMLFormattingOptions
- java.lang.Object
-
- org.eclipse.lemminx.settings.LSPFormattingOptions
-
- org.eclipse.lemminx.settings.XMLFormattingOptions
-
public class XMLFormattingOptions extends LSPFormattingOptions
This class is the root of all formatting settings. It is necessary to update this class for any new additions. All defaults should be set here to eventually be overridden if needed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMLFormattingOptions.EmptyElementsOptions for formatting empty elements.static classXMLFormattingOptions.SplitAttributes
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_CLOSING_BRACKET_NEW_LINEstatic EnforceQuoteStyleDEFAULT_ENFORCE_QUOTE_STYLEstatic booleanDEFAULT_PRESERVE_ATTR_LINE_BREAKSstatic List<String>DEFAULT_PRESERVE_SPACEstatic intDEFAULT_PRESERVER_NEW_LINESstatic StringDEFAULT_QUOTATIONstatic intDEFAULT_SPLIT_ATTRIBUTES_INDENT_SIZEstatic intDEFAULT_TAB_SIZEstatic booleanDEFAULT_TRIM_TRAILING_SPACESstatic StringDEFAULT_XSI_SCHEMA_LOCATION_SPLIT
-
Constructor Summary
Constructors Constructor Description XMLFormattingOptions()XMLFormattingOptions(boolean initializeDefaults)Create an XMLFormattingOptions instance with the option to initialize default values for all supported settings.XMLFormattingOptions(int tabSize, boolean insertSpaces)XMLFormattingOptions(int tabSize, boolean insertSpaces, boolean initializeDefaultSettings)XMLFormattingOptions(org.eclipse.lsp4j.FormattingOptions options)XMLFormattingOptions(org.eclipse.lsp4j.FormattingOptions options, boolean initializeDefaultSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetClosingBracketNewLine()Returns the value of closingBracketNewLine or false if it was set to null A setting for enabling the XML formatter to move the closing bracket of a tag with at least 2 attributes to a new line.XMLFormattingOptions.EmptyElementsgetEmptyElements()EnforceQuoteStylegetEnforceQuoteStyle()FormatElementCategorygetFormatElementCategory(DOMElement element)intgetMaxLineWidth()Returns the value of max line width or zero if it was set to a negative valueintgetPreservedNewlines()List<String>getPreserveSpace()Returns the element name list which must preserve space.XMLFormattingOptions.SplitAttributesgetSplitAttributes()intgetSplitAttributesIndentSize()Returns the value of splitAttributesIndentSize or zero if it was set to a negative valueStringgetXsiSchemaLocationSplit()booleanisEnabled()booleanisFormatComments()booleanisGrammarAwareFormatting()booleanisJoinCDATALines()booleanisJoinCommentLines()booleanisJoinContentLines()booleanisLegacy()Returns true if the legacy formatter must be used and false otherwise.booleanisPreserveAttributeLineBreaks()Returns the value of preserveAttrLineBreaksbooleanisPreserveEmptyContent()booleanisSpaceBeforeEmptyCloseTag()XMLFormattingOptionsmerge(XMLFormattingOptions formattingOptions)XMLFormattingOptionsmerge(org.eclipse.lsp4j.FormattingOptions formattingOptions)voidsetClosingBracketNewLine(boolean closingBracketNewLine)Sets the value of closingBracketNewLinevoidsetEmptyElement(XMLFormattingOptions.EmptyElements emptyElement)voidsetEnabled(boolean enabled)voidsetEnforceQuoteStyle(EnforceQuoteStyle enforce)voidsetFormatComments(boolean formatComments)voidsetGrammarAwareFormatting(boolean grammarAwareFormatting)voidsetJoinCDATALines(boolean joinCDATALines)voidsetJoinCommentLines(boolean joinCommentLines)voidsetJoinContentLines(boolean joinContentLines)voidsetLegacy(boolean legacy)Set true if the legacy formatter must be used and false otherwise.voidsetMaxLineWidth(int maxLineWidth)Sets the value of max line width.voidsetPreserveAttributeLineBreaks(boolean preserveAttributeLineBreaks)Sets the value of preserveAttrLineBreaksvoidsetPreservedNewlines(int preservedNewlines)voidsetPreserveEmptyContent(boolean preserveEmptyContent)voidsetPreserveSpace(List<String> preserveSpace)Sets the element name list which must preserve space.voidsetSpaceBeforeEmptyCloseTag(boolean spaceBeforeEmptyCloseTag)voidsetSplitAttributes(XMLFormattingOptions.SplitAttributes splitAttributes)voidsetSplitAttributesIndentSize(int splitAttributesIndentSize)Sets the value of splitAttributesIndentSizevoidsetXsiSchemaLocationSplit(String xsiSchemaLocationSplit)-
Methods inherited from class org.eclipse.lemminx.settings.LSPFormattingOptions
getTabSize, isInsertFinalNewline, isInsertSpaces, isTrimFinalNewlines, isTrimTrailingWhitespace, setInsertFinalNewline, setInsertSpaces, setTabSize, setTrimFinalNewlines, setTrimTrailingWhitespace
-
-
-
-
Field Detail
-
DEFAULT_QUOTATION
public static final String DEFAULT_QUOTATION
- See Also:
- Constant Field Values
-
DEFAULT_PRESERVER_NEW_LINES
public static final int DEFAULT_PRESERVER_NEW_LINES
- See Also:
- Constant Field Values
-
DEFAULT_TAB_SIZE
public static final int DEFAULT_TAB_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_ENFORCE_QUOTE_STYLE
public static final EnforceQuoteStyle DEFAULT_ENFORCE_QUOTE_STYLE
-
DEFAULT_PRESERVE_ATTR_LINE_BREAKS
public static final boolean DEFAULT_PRESERVE_ATTR_LINE_BREAKS
- See Also:
- Constant Field Values
-
DEFAULT_TRIM_TRAILING_SPACES
public static final boolean DEFAULT_TRIM_TRAILING_SPACES
- See Also:
- Constant Field Values
-
DEFAULT_SPLIT_ATTRIBUTES_INDENT_SIZE
public static final int DEFAULT_SPLIT_ATTRIBUTES_INDENT_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_XSI_SCHEMA_LOCATION_SPLIT
public static final String DEFAULT_XSI_SCHEMA_LOCATION_SPLIT
-
DEFAULT_CLOSING_BRACKET_NEW_LINE
public static final boolean DEFAULT_CLOSING_BRACKET_NEW_LINE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XMLFormattingOptions
public XMLFormattingOptions()
-
XMLFormattingOptions
public XMLFormattingOptions(boolean initializeDefaults)
Create an XMLFormattingOptions instance with the option to initialize default values for all supported settings.
-
XMLFormattingOptions
public XMLFormattingOptions(int tabSize, boolean insertSpaces, boolean initializeDefaultSettings)
-
XMLFormattingOptions
public XMLFormattingOptions(int tabSize, boolean insertSpaces)
-
XMLFormattingOptions
public XMLFormattingOptions(org.eclipse.lsp4j.FormattingOptions options, boolean initializeDefaultSettings)
-
XMLFormattingOptions
public XMLFormattingOptions(org.eclipse.lsp4j.FormattingOptions options)
-
-
Method Detail
-
getSplitAttributes
public XMLFormattingOptions.SplitAttributes getSplitAttributes()
-
setSplitAttributes
public void setSplitAttributes(XMLFormattingOptions.SplitAttributes splitAttributes)
-
isJoinCDATALines
public boolean isJoinCDATALines()
-
setJoinCDATALines
public void setJoinCDATALines(boolean joinCDATALines)
-
isFormatComments
public boolean isFormatComments()
-
setFormatComments
public void setFormatComments(boolean formatComments)
-
isJoinCommentLines
public boolean isJoinCommentLines()
-
setJoinCommentLines
public void setJoinCommentLines(boolean joinCommentLines)
-
isJoinContentLines
public boolean isJoinContentLines()
-
setJoinContentLines
public void setJoinContentLines(boolean joinContentLines)
-
isLegacy
public boolean isLegacy()
Returns true if the legacy formatter must be used and false otherwise.- Returns:
- true if the legacy formatter must be used and false otherwise.
-
setLegacy
public void setLegacy(boolean legacy)
Set true if the legacy formatter must be used and false otherwise.- Parameters:
legacy- true if the legacy formatter must be used and false otherwise.
-
setMaxLineWidth
public void setMaxLineWidth(int maxLineWidth)
Sets the value of max line width.- Parameters:
maxLineWidth- the new value for max line width.
-
getMaxLineWidth
public int getMaxLineWidth()
Returns the value of max line width or zero if it was set to a negative value- Returns:
- the value of max line width or zero if it was set to a negative value
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
-
setSpaceBeforeEmptyCloseTag
public void setSpaceBeforeEmptyCloseTag(boolean spaceBeforeEmptyCloseTag)
-
isSpaceBeforeEmptyCloseTag
public boolean isSpaceBeforeEmptyCloseTag()
-
setPreserveEmptyContent
public void setPreserveEmptyContent(boolean preserveEmptyContent)
-
isPreserveEmptyContent
public boolean isPreserveEmptyContent()
-
setPreservedNewlines
public void setPreservedNewlines(int preservedNewlines)
-
getPreservedNewlines
public int getPreservedNewlines()
-
setEmptyElement
public void setEmptyElement(XMLFormattingOptions.EmptyElements emptyElement)
-
getEmptyElements
public XMLFormattingOptions.EmptyElements getEmptyElements()
-
setEnforceQuoteStyle
public void setEnforceQuoteStyle(EnforceQuoteStyle enforce)
-
getEnforceQuoteStyle
public EnforceQuoteStyle getEnforceQuoteStyle()
-
setPreserveAttributeLineBreaks
public void setPreserveAttributeLineBreaks(boolean preserveAttributeLineBreaks)
Sets the value of preserveAttrLineBreaks
-
isPreserveAttributeLineBreaks
public boolean isPreserveAttributeLineBreaks()
Returns the value of preserveAttrLineBreaks- Returns:
- the value of preserveAttrLineBreaks
-
setSplitAttributesIndentSize
public void setSplitAttributesIndentSize(int splitAttributesIndentSize)
Sets the value of splitAttributesIndentSize- Parameters:
splitAttributesIndentSize- the new value for splitAttributesIndentSize
-
getSplitAttributesIndentSize
public int getSplitAttributesIndentSize()
Returns the value of splitAttributesIndentSize or zero if it was set to a negative value- Returns:
- the value of splitAttributesIndentSize or zero if it was set to a negative value
-
getClosingBracketNewLine
public boolean getClosingBracketNewLine()
Returns the value of closingBracketNewLine or false if it was set to null A setting for enabling the XML formatter to move the closing bracket of a tag with at least 2 attributes to a new line.- Returns:
- the value of closingBracketNewLine or false if it was set to null
-
setClosingBracketNewLine
public void setClosingBracketNewLine(boolean closingBracketNewLine)
Sets the value of closingBracketNewLine- Parameters:
closingBracketNewLine- the new value for closingBracketNewLine
-
setPreserveSpace
public void setPreserveSpace(List<String> preserveSpace)
Sets the element name list which must preserve space.- Parameters:
preserveSpace- the element name list which must preserve space.
-
getPreserveSpace
public List<String> getPreserveSpace()
Returns the element name list which must preserve space.- Returns:
- the element name list which must preserve space.
-
isGrammarAwareFormatting
public boolean isGrammarAwareFormatting()
-
setGrammarAwareFormatting
public void setGrammarAwareFormatting(boolean grammarAwareFormatting)
-
getXsiSchemaLocationSplit
public String getXsiSchemaLocationSplit()
-
setXsiSchemaLocationSplit
public void setXsiSchemaLocationSplit(String xsiSchemaLocationSplit)
-
merge
public XMLFormattingOptions merge(XMLFormattingOptions formattingOptions)
-
merge
public XMLFormattingOptions merge(org.eclipse.lsp4j.FormattingOptions formattingOptions)
-
getFormatElementCategory
public FormatElementCategory getFormatElementCategory(DOMElement element)
-
-