From 85054e25a5f10c67a04495a5be0b9dbc48610d19 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 27 May 2015 11:44:27 +0200 Subject: [PATCH] inconsistent psi tree length diagnostics ( EA-53915 - assert: LowLevelSearchUtil.processElementsContainingWordInElement) --- .../psi/SingleRootFileViewProvider.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java index 0b76ed43ed61..539fe4707a21 100644 --- a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java +++ b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java @@ -165,10 +165,6 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi @Override public void contentsSynchronized() { - unsetPsiContent(); - } - - private void unsetPsiContent() { if (!(myContent instanceof PsiFileContent)) return; setContent(new VirtualFileContent()); } @@ -452,14 +448,18 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi } private void setContent(@NotNull Content content) { - // temporarily commented - //if (myPhysical) { - // final Content oldContent = myContent; - // if (oldContent != null && content.getModificationStamp() != oldContent.getModificationStamp()) { - // ApplicationManager.getApplication().assertWriteAccessAllowed(); - // } - //} + Content prevContent = myContent; myContent = content; + if (prevContent instanceof PsiFileContent && content instanceof VirtualFileContent) { + int fileLength = content.getText().length(); + for (FileElement fileElement : getKnownTreeRoots()) { + int nodeLength = fileElement.getTextLength(); + if (nodeLength != fileLength) { + LOG.error("Inconsistent " + fileElement.getElementType() + " tree in " + this + "; nodeLength=" + nodeLength + "; fileLength=" + fileLength); + } + } + } + } @NonNls