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
`static class` `XMLFormattingOptions.EmptyElements` Options for formatting empty elements.
`static class` `XMLFormattingOptions.SplitAttributes`

### Field Summary

Fields
`static boolean` `DEFAULT_CLOSING_BRACKET_NEW_LINE`
`static EnforceQuoteStyle` `DEFAULT_ENFORCE_QUOTE_STYLE`
`static boolean` `DEFAULT_PRESERVE_ATTR_LINE_BREAKS`
`static List<String>` `DEFAULT_PRESERVE_SPACE`
`static int` `DEFAULT_PRESERVER_NEW_LINES`
`static String` `DEFAULT_QUOTATION`
`static int` `DEFAULT_SPLIT_ATTRIBUTES_INDENT_SIZE`
`static int` `DEFAULT_TAB_SIZE`
`static boolean` `DEFAULT_TRIM_TRAILING_SPACES`
`static String` `DEFAULT_XSI_SCHEMA_LOCATION_SPLIT`

### Constructor Summary

Constructors
`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
`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.
`XMLFormattingOptions.EmptyElements` `getEmptyElements()`
`EnforceQuoteStyle` `getEnforceQuoteStyle()`
`FormatElementCategory` `getFormatElementCategory​(DOMElement element)`
`int` `getMaxLineWidth()` Returns the value of max line width or zero if it was set to a negative value
`int` `getPreservedNewlines()`
`List<String>` `getPreserveSpace()` Returns the element name list which must preserve space.
`XMLFormattingOptions.SplitAttributes` `getSplitAttributes()`
`int` `getSplitAttributesIndentSize()` Returns the value of splitAttributesIndentSize or zero if it was set to a negative value
`String` `getXsiSchemaLocationSplit()`
`boolean` `isEnabled()`
`boolean` `isFormatComments()`
`boolean` `isGrammarAwareFormatting()`
`boolean` `isJoinCDATALines()`
`boolean` `isJoinCommentLines()`
`boolean` `isJoinContentLines()`
`boolean` `isLegacy()` Returns true if the legacy formatter must be used and false otherwise.
`boolean` `isPreserveAttributeLineBreaks()` Returns the value of preserveAttrLineBreaks
`boolean` `isPreserveEmptyContent()`
`boolean` `isSpaceBeforeEmptyCloseTag()`
`XMLFormattingOptions` `merge​(XMLFormattingOptions formattingOptions)`
`XMLFormattingOptions` `merge​(org.eclipse.lsp4j.FormattingOptions formattingOptions)`
`void` `setClosingBracketNewLine​(boolean closingBracketNewLine)` Sets the value of closingBracketNewLine
`void` `setEmptyElement​(XMLFormattingOptions.EmptyElements emptyElement)`
`void` `setEnabled​(boolean enabled)`
`void` `setEnforceQuoteStyle​(EnforceQuoteStyle enforce)`
`void` `setFormatComments​(boolean formatComments)`
`void` `setGrammarAwareFormatting​(boolean grammarAwareFormatting)`
`void` `setJoinCDATALines​(boolean joinCDATALines)`
`void` `setJoinCommentLines​(boolean joinCommentLines)`
`void` `setJoinContentLines​(boolean joinContentLines)`
`void` `setLegacy​(boolean legacy)` Set true if the legacy formatter must be used and false otherwise.
`void` `setMaxLineWidth​(int maxLineWidth)` Sets the value of max line width.
`void` `setPreserveAttributeLineBreaks​(boolean preserveAttributeLineBreaks)` Sets the value of preserveAttrLineBreaks
`void` `setPreservedNewlines​(int preservedNewlines)`
`void` `setPreserveEmptyContent​(boolean preserveEmptyContent)`
`void` `setPreserveSpace​(List<String> preserveSpace)` Sets the element name list which must preserve space.
`void` `setSpaceBeforeEmptyCloseTag​(boolean spaceBeforeEmptyCloseTag)`
`void` `setSplitAttributes​(XMLFormattingOptions.SplitAttributes splitAttributes)`
`void` `setSplitAttributesIndentSize​(int splitAttributesIndentSize)` Sets the value of splitAttributesIndentSize
`void` `setXsiSchemaLocationSplit​(String xsiSchemaLocationSplit)`

### Methods inherited from class org.eclipse.lemminx.settings.LSPFormattingOptions

`getTabSize, isInsertFinalNewline, isInsertSpaces, isTrimFinalNewlines, isTrimTrailingWhitespace, setInsertFinalNewline, setInsertSpaces, setTabSize, setTrimFinalNewlines, setTrimTrailingWhitespace`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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

#### DEFAULT_PRESERVE_SPACE

    public static final List<String> DEFAULT_PRESERVE_SPACE

### 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)