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.
  • Field Details

    • DEFAULT_QUOTATION

      public static final String 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

      public static final EnforceQuoteStyle 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

      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:
    • DEFAULT_PRESERVE_SPACE

      public static final List<String> 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

      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)