Package org.eclipse.lemminx.settings
Class XMLFormattingOptions
java.lang.Object
org.eclipse.lemminx.settings.LSPFormattingOptions
org.eclipse.lemminx.settings.XMLFormattingOptions
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 ClassesModifier and TypeClassDescriptionstatic enumOptions for formatting empty elements. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final EnforceQuoteStylestatic final booleanstatic final intstatic final Stringstatic final intstatic final intstatic final booleanstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionXMLFormattingOptions(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
Modifier and TypeMethodDescriptionbooleanReturns 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.getFormatElementCategory(DOMElement element) intReturns the value of max line width or zero if it was set to a negative valueintReturns the element name list which must preserve space.intReturns the value of splitAttributesIndentSize or zero if it was set to a negative valuebooleanbooleanbooleanbooleanbooleanbooleanbooleanisLegacy()Returns true if the legacy formatter must be used and false otherwise.booleanReturns the value of preserveAttrLineBreaksbooleanbooleanbooleanmerge(XMLFormattingOptions formattingOptions) merge(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(boolean 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 Details
-
DEFAULT_QUOTATION
- See Also:
-
DEFAULT_PRESERVER_NEW_LINES
public static final int DEFAULT_PRESERVER_NEW_LINES- See Also:
-
DEFAULT_TAB_SIZE
public static final int DEFAULT_TAB_SIZE- See Also:
-
DEFAULT_ENFORCE_QUOTE_STYLE
-
DEFAULT_PRESERVE_ATTR_LINE_BREAKS
public static final boolean DEFAULT_PRESERVE_ATTR_LINE_BREAKS- See Also:
-
DEFAULT_TRIM_TRAILING_SPACES
public static final boolean DEFAULT_TRIM_TRAILING_SPACES- See Also:
-
DEFAULT_SPLIT_ATTRIBUTES_INDENT_SIZE
public static final int DEFAULT_SPLIT_ATTRIBUTES_INDENT_SIZE- See Also:
-
DEFAULT_XSI_SCHEMA_LOCATION_SPLIT
-
DEFAULT_CLOSING_BRACKET_NEW_LINE
public static final boolean DEFAULT_CLOSING_BRACKET_NEW_LINE- See Also:
-
DEFAULT_PRESERVE_SPACE
-
-
Constructor Details
-
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 Details
-
isSplitAttributes
public boolean isSplitAttributes() -
setSplitAttributes
public void setSplitAttributes(boolean 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
-
getEmptyElements
-
setEnforceQuoteStyle
-
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
Sets the element name list which must preserve space.- Parameters:
preserveSpace- the element name list which must preserve space.
-
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
-
setXsiSchemaLocationSplit
-
merge
-
merge
-
getFormatElementCategory
-