From 455bce5ea882e571e2917ca5f0c241c01e013927 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 21 Nov 2017 23:09:36 +0100 Subject: [PATCH] update LazyParseableElement children under a non-cancellable section after parsing --- .../source/tree/LazyParseableElement.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LazyParseableElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LazyParseableElement.java index e0d5f2e0c9db..9abf03d2cd28 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LazyParseableElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LazyParseableElement.java @@ -23,6 +23,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.diagnostic.LogUtil; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.Getter; import com.intellij.openapi.util.StaticGetter; import com.intellij.psi.impl.DebugUtil; @@ -222,15 +223,17 @@ public class LazyParseableElement extends CompositeElement { } private void setChildren(@NotNull TreeElement parsedNode, @Nullable AstPath thisPath) { - try { - AstPath.cacheNodePaths(this, parsedNode, thisPath); - TreeElement last = rawSetParents(parsedNode, this); - super.setFirstChildNode(parsedNode); - super.setLastChildNode(last); - } - catch (Throwable e) { - LOG.error("Chameleon expansion may not be interrupted by exceptions", e); - } + ProgressManager.getInstance().executeNonCancelableSection(() -> { + try { + AstPath.cacheNodePaths(this, parsedNode, thisPath); + TreeElement last = rawSetParents(parsedNode, this); + super.setFirstChildNode(parsedNode); + super.setLastChildNode(last); + } + catch (Throwable e) { + LOG.error("Chameleon expansion may not be interrupted by exceptions", e); + } + }); } @Override