void (@NotNull TreeChangeEventImpl changeSet, @NotNull PsiFile file) { if (file instanceof DummyHolder || !toProcessPsiEvent()) return; Document document = getCachedDocument(file, false); DocumentChangeTransaction transaction = document == null ? null : getTransaction(document); if (transaction == null) return; for (TreeChangeImpl change : changeSet.getSortedChanges()) { int parentStart = change.getChangedParent().getStartOffset(); for (ASTNode child : change.getAffectedChildren()) { ChangeInfoImpl info = change.getChangeByChild(child); ASTNode newChild = info.getNewChild(); PsiElement newPsi = newChild == null ? null : newChild.getPsi(); if (!(newPsi instanceof ForeignLeafPsiElement)) { transaction.replace(info.getOffsetInParent() + parentStart, info.getOldLength(), newChild == null ? "" : newChild.getText(), newPsi); } } } }