diff --git a/platform/core-impl/api-dump.txt b/platform/core-impl/api-dump.txt index 473a5d01f6a5..ee3c0aa9149f 100644 --- a/platform/core-impl/api-dump.txt +++ b/platform/core-impl/api-dump.txt @@ -168,6 +168,8 @@ f:com.intellij.psi.ExternalChangeActionUtil com.intellij.psi.impl.AnyPsiChangeListener - afterPsiChanged(Z):V - beforePsiChanged(Z):V +f:com.intellij.psi.impl.DebugUtil +- s:lightTreeAsElementTypeToString(com.intellij.util.diff.FlyweightCapableTreeStructure,Z):java.lang.String com.intellij.psi.impl.PsiDocumentTransactionListener - sf:TOPIC:com.intellij.util.messages.Topic - transactionCompleted(com.intellij.openapi.editor.Document,com.intellij.psi.PsiFile):V diff --git a/platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java b/platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java index 3fa7b738d0ef..db79d472d2a0 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java @@ -221,7 +221,13 @@ public final class DebugUtil { public static @NotNull String lightTreeToString(@NotNull FlyweightCapableTreeStructure tree, boolean showWhitespaces) { StringBuilder buffer = new StringBuilder(); - lightTreeToBuffer(tree, tree.getRoot(), buffer, 0, showWhitespaces); + lightTreeToBuffer(tree, tree.getRoot(), buffer, 0, showWhitespaces, true); + return buffer.toString(); + } + + public static @NotNull String lightTreeAsElementTypeToString(@NotNull FlyweightCapableTreeStructure tree, boolean showWhitespaces) { + StringBuilder buffer = new StringBuilder(); + lightTreeToBuffer(tree, tree.getRoot(), buffer, 0, showWhitespaces, false); return buffer.toString(); } @@ -229,7 +235,8 @@ public final class DebugUtil { @NotNull LighterASTNode node, Appendable buffer, int indent, - boolean showWhitespaces) { + boolean showWhitespaces, + boolean showPsiElements) { IElementType tokenType = node.getTokenType(); if (!showWhitespaces && tokenType == TokenType.WHITE_SPACE) return; @@ -238,13 +245,28 @@ public final class DebugUtil { StringUtil.repeatSymbol(buffer, ' ', indent); try { if (tokenType == TokenType.ERROR_ELEMENT) { - buffer.append("PsiErrorElement:").append(PsiBuilderImpl.getErrorMessage(node)); + if (showPsiElements) { + buffer.append("PsiErrorElement:").append(PsiBuilderImpl.getErrorMessage(node)); + } + else { + buffer.append(tokenType.toString()).append(":").append(PsiBuilderImpl.getErrorMessage(node)); + } } else if (tokenType == TokenType.WHITE_SPACE) { - buffer.append("PsiWhiteSpace"); + if (showPsiElements) { + buffer.append("PsiWhiteSpace"); + } + else { + buffer.append(tokenType.toString()); + } } else { - buffer.append(isLeaf ? "PsiElement" : "Element").append('(').append(tokenType.toString()).append(')'); + if (showPsiElements) { + buffer.append(isLeaf ? "PsiElement" : "Element").append('(').append(tokenType.toString()).append(')'); + } + else { + buffer.append(tokenType.toString()); + } } if (isLeaf) { @@ -262,7 +284,7 @@ public final class DebugUtil { } else { for (int i = 0; i < numKids; i++) { - lightTreeToBuffer(tree, kids.get()[i], buffer, indent + 2, showWhitespaces); + lightTreeToBuffer(tree, kids.get()[i], buffer, indent + 2, showWhitespaces, showPsiElements); } } }