mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Several fixes in synchronization schema
This commit is contained in:
@@ -6,6 +6,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.psi.impl.source.jsp.JspxFileImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -36,6 +37,7 @@ public abstract class ParsingTestCase extends LightIdeaTestCase {
|
||||
else{
|
||||
toParseTreeText(file);
|
||||
}
|
||||
if(file instanceof JspxFileImpl) ((JspxFileImpl)file).checkAllTreesEqual();
|
||||
}
|
||||
|
||||
protected void checkResult(String targetDataName, final PsiFile file) throws Exception {
|
||||
|
||||
@@ -29,9 +29,15 @@ public class DebugUtil {
|
||||
|
||||
public static String treeToString(ASTNode root, boolean skipWhitespaces) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
treeToBuffer(buffer, root, 0, skipWhitespaces);
|
||||
treeToBuffer(buffer, root, 0, skipWhitespaces, false);
|
||||
return buffer.toString();
|
||||
}
|
||||
public static String treeToString(ASTNode root, boolean skipWhitespaces, boolean showRanges) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
treeToBuffer(buffer, root, 0, skipWhitespaces, showRanges);
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String treeToStringWithUserData(TreeElement root, boolean skipWhitespaces) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
@@ -63,7 +69,7 @@ public class DebugUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void treeToBuffer(StringBuffer buffer, ASTNode root, int indent, boolean skipWhiteSpaces) {
|
||||
private static void treeToBuffer(StringBuffer buffer, ASTNode root, int indent, boolean skipWhiteSpaces, boolean showRanges) {
|
||||
if (skipWhiteSpaces && root.getElementType() == ElementType.WHITE_SPACE) return;
|
||||
|
||||
for (int i = 0; i < indent; i++) {
|
||||
@@ -85,6 +91,7 @@ public class DebugUtil {
|
||||
text = StringUtil.replace(text, "\t", "\\t");
|
||||
buffer.append(root.toString() + "('" + text + "')");
|
||||
}
|
||||
if(showRanges) buffer.append(root.getTextRange());
|
||||
buffer.append("\n");
|
||||
if (root instanceof CompositeElement) {
|
||||
ChameleonTransforming.transformChildren(root);
|
||||
@@ -98,7 +105,7 @@ public class DebugUtil {
|
||||
}
|
||||
else {
|
||||
while (child != null) {
|
||||
treeToBuffer(buffer, child, indent + 2, skipWhiteSpaces);
|
||||
treeToBuffer(buffer, child, indent + 2, skipWhiteSpaces, false);
|
||||
child = child.getTreeNext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,8 +251,8 @@ public class CodeStyleManagerImpl extends CodeStyleManagerEx implements ProjectC
|
||||
ASTNode next = element.getTreeNext();
|
||||
ASTNode space1 = Helper.splitSpaceElement((TreeElement)element, end - spaceStart, charTable);
|
||||
ASTNode tempElement = Factory.createSingleLeafElement(
|
||||
ElementType.NEW_LINE_INDENT, "###".toCharArray(), 0,
|
||||
"###".length(), charTable, null);
|
||||
ElementType.NEW_LINE_INDENT, "xxx".toCharArray(), 0,
|
||||
"xxx".length(), charTable, null);
|
||||
parent.addChild(tempElement, space1.getTreeNext());
|
||||
tempElement = new IndentAdjusterFacade(getSettings(), helper).adjustIndent(tempElement);
|
||||
offset = tempElement.getTextRange().getStartOffset();
|
||||
|
||||
@@ -508,7 +508,8 @@ public class XmlUtil {
|
||||
final FileType fileType = file.getFileType();
|
||||
|
||||
if (fileType == StdFileTypes.HTML ||
|
||||
fileType == StdFileTypes.XHTML
|
||||
fileType == StdFileTypes.XHTML ||
|
||||
fileType == StdFileTypes.JSPX
|
||||
) {
|
||||
return XHTML_URI;
|
||||
}
|
||||
@@ -811,7 +812,10 @@ public class XmlUtil {
|
||||
}
|
||||
|
||||
public static String decode(String text){
|
||||
if(text.charAt(0) != '&' || text.length() > 6 || text.length() < 3) return text;
|
||||
if(text.charAt(0) != '&' || text.length() > 6 || text.length() < 3){
|
||||
if(text.indexOf('<') < 0 && text.indexOf('>') < 0) return text;
|
||||
return text.replaceAll("<!\\[CDATA\\[", "").replaceAll("\\]\\]>", "");
|
||||
}
|
||||
|
||||
if(text.equals("<")) {
|
||||
return "<";
|
||||
|
||||
Reference in New Issue
Block a user