public class XMLFormatterDocument extends Object
Constructor and Description |
---|
XMLFormatterDocument(DOMDocument xmlDocument,
org.eclipse.lsp4j.Range range,
SharedSettings sharedSettings,
Collection<IFormatterParticipant> formatterParticipants)
XML formatter document.
|
Modifier and Type | Method and Description |
---|---|
int |
adjustOffsetWithLeftWhitespaces(int leftLimit,
int to) |
List<? extends org.eclipse.lsp4j.TextEdit> |
format()
Returns a List containing multiple TextEdit, containing the newly formatted
changes of an XML document.
|
List<? extends org.eclipse.lsp4j.TextEdit> |
format(DOMDocument document,
int start,
int end) |
void |
format(DOMNode child,
XMLFormattingConstraints parentConstraints,
int start,
int end,
List<org.eclipse.lsp4j.TextEdit> edits) |
void |
formatAttributeValue(DOMAttr attr,
XMLFormattingConstraints parentConstraints,
List<org.eclipse.lsp4j.TextEdit> edits) |
void |
formatChildren(DOMNode currentDOMNode,
XMLFormattingConstraints parentConstraints,
int start,
int end,
List<org.eclipse.lsp4j.TextEdit> edits) |
static int |
getExistingNewLineCount(String text,
int offset,
String delimiter)
Return the number of new lines in the whitespaces to the left of the given
offset.
|
FormatElementCategory |
getFormatElementCategory(DOMElement element,
XMLFormattingConstraints parentConstraints)
Returns the format element category of the given DOM element.
|
int |
getLineAtOffset(int offset) |
int |
getLineBreakOffset(int startAttr,
int start) |
int |
getMaxLineWidth() |
int |
getNormalizedLength(int from,
int to) |
int |
getOffsetWithPreserveLineBreaks(int from,
int to,
int tabSize,
boolean isInsertSpaces) |
boolean |
isMaxLineWidthSupported() |
void |
removeLeftSpaces(int leftLimit,
int to,
List<org.eclipse.lsp4j.TextEdit> edits) |
int |
replaceLeftSpacesWithIndentation(int indentLevel,
int leftLimit,
int to,
boolean addLineSeparator,
List<org.eclipse.lsp4j.TextEdit> edits) |
void |
replaceLeftSpacesWithIndentationPreservedNewLines(int spaceStart,
int spaceEnd,
int indentLevel,
List<org.eclipse.lsp4j.TextEdit> edits) |
int |
replaceLeftSpacesWithIndentationWithMultiNewLines(int indentLevel,
int leftLimit,
int offset,
int newLineCount,
List<org.eclipse.lsp4j.TextEdit> edits) |
int |
replaceLeftSpacesWithIndentationWithOffsetSpaces(int indentSpace,
int leftLimit,
int to,
boolean addLineSeparator,
List<org.eclipse.lsp4j.TextEdit> edits) |
void |
replaceLeftSpacesWithOneSpace(int leftLimit,
int to,
List<org.eclipse.lsp4j.TextEdit> edits) |
boolean |
shouldCollapseEmptyElement(DOMElement element,
SharedSettings sharedSettings) |
public XMLFormatterDocument(DOMDocument xmlDocument, org.eclipse.lsp4j.Range range, SharedSettings sharedSettings, Collection<IFormatterParticipant> formatterParticipants)
public List<? extends org.eclipse.lsp4j.TextEdit> format() throws BadLocationException
BadLocationException
public List<? extends org.eclipse.lsp4j.TextEdit> format(DOMDocument document, int start, int end)
public void format(DOMNode child, XMLFormattingConstraints parentConstraints, int start, int end, List<org.eclipse.lsp4j.TextEdit> edits)
public void formatChildren(DOMNode currentDOMNode, XMLFormattingConstraints parentConstraints, int start, int end, List<org.eclipse.lsp4j.TextEdit> edits)
public void formatAttributeValue(DOMAttr attr, XMLFormattingConstraints parentConstraints, List<org.eclipse.lsp4j.TextEdit> edits)
public void removeLeftSpaces(int leftLimit, int to, List<org.eclipse.lsp4j.TextEdit> edits)
public void replaceLeftSpacesWithOneSpace(int leftLimit, int to, List<org.eclipse.lsp4j.TextEdit> edits)
public int adjustOffsetWithLeftWhitespaces(int leftLimit, int to)
public int replaceLeftSpacesWithIndentation(int indentLevel, int leftLimit, int to, boolean addLineSeparator, List<org.eclipse.lsp4j.TextEdit> edits)
public int replaceLeftSpacesWithIndentationWithMultiNewLines(int indentLevel, int leftLimit, int offset, int newLineCount, List<org.eclipse.lsp4j.TextEdit> edits)
public int replaceLeftSpacesWithIndentationWithOffsetSpaces(int indentSpace, int leftLimit, int to, boolean addLineSeparator, List<org.eclipse.lsp4j.TextEdit> edits)
public void replaceLeftSpacesWithIndentationPreservedNewLines(int spaceStart, int spaceEnd, int indentLevel, List<org.eclipse.lsp4j.TextEdit> edits)
public int getNormalizedLength(int from, int to)
public int getOffsetWithPreserveLineBreaks(int from, int to, int tabSize, boolean isInsertSpaces)
public int getLineBreakOffset(int startAttr, int start)
public FormatElementCategory getFormatElementCategory(DOMElement element, XMLFormattingConstraints parentConstraints)
element
- the DOM element.parentConstraints
- the parent constraints.public boolean shouldCollapseEmptyElement(DOMElement element, SharedSettings sharedSettings)
public static int getExistingNewLineCount(String text, int offset, String delimiter)
text
- the xml text.offset
- the offset to begin the count from.delimiter
- the delimiter.public boolean isMaxLineWidthSupported()
public int getMaxLineWidth()
public int getLineAtOffset(int offset)
Copyright © 2022. All rights reserved.