Skip to content

Commit

Permalink
Provide basic experimental formatter which supports invalid XML
Browse files Browse the repository at this point in the history
Fixes eclipse#1195

Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
angelozerr committed Apr 14, 2022
1 parent 6113791 commit 1a4e9cc
Show file tree
Hide file tree
Showing 15 changed files with 4,892 additions and 793 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public String lineText(int lineNumber) throws BadLocationException {
return text.substring(line.offset, line.offset + line.length);
}

public int lineOffsetAt(int position) throws BadLocationException {
ILineTracker lineTracker = getLineTracker();
Line line = lineTracker.getLineInformationOfOffset(position);
return line.offset;
}

public String lineDelimiter(int lineNumber) throws BadLocationException {
ILineTracker lineTracker = getLineTracker();
String lineDelimiter = lineTracker.getLineDelimiter(lineNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.eclipse.lemminx.dom;

import org.eclipse.lemminx.utils.StringUtils;
import org.w3c.dom.DOMException;

/**
Expand Down Expand Up @@ -61,7 +62,8 @@ public String getWholeText() {
*/
@Override
public boolean isElementContentWhitespace() {
throw new UnsupportedOperationException();
String text = getOwnerDocument().getOwnerDocument().getText();
return StringUtils.isWhitespace(text, getStart(), getEnd());
}

/*
Expand Down
Loading

0 comments on commit 1a4e9cc

Please sign in to comment.