TreeElement (@NotNull PsiElement original) { DummyHolder holder = DummyHolderFactory.createHolder(original.getManager(), null, original.getLanguage()); FileElement holderElement = holder.getTreeElement(); TreeElement treeElement = generateTreeElement(original, holderElement.getCharTable(), original.getManager()); // TreeElement treePrev = treeElement.getTreePrev(); // This is hack to support bug used in formater LOG.assertTrue( treeElement != null, "original element class: " + original.getClass().getName() + ", language: " + original.getLanguage() ); holderElement.rawAddChildren(treeElement); TreeUtil.clearCaches(holderElement); // treeElement.setTreePrev(treePrev); saveIndentationToCopy((TreeElement)original.getNode(), treeElement); return treeElement; }