From 703dce2995fd78ab7fa8ed7d4d4dd5c6af51dbf5 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 18 Feb 2015 17:25:51 +0100 Subject: [PATCH] enable slow live template result calculation in dumb mode (EA-64952 - INRE: FileBasedIndexImpl.handleDumbMode) --- .../codeInsight/template/impl/TemplateState.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java index 23b90f295752..99a064368e30 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java @@ -664,12 +664,17 @@ public class TemplateState implements Disposable { calcedSegments.clear(); for (int i = myCurrentVariableNumber + 1; i < myTemplate.getVariableCount(); i++) { String variableName = myTemplate.getVariableNameAt(i); - int segmentNumber = myTemplate.getVariableSegmentNumber(variableName); + final int segmentNumber = myTemplate.getVariableSegmentNumber(variableName); if (segmentNumber < 0) continue; - Expression expression = myTemplate.getExpressionAt(i); - Expression defaultValue = myTemplate.getDefaultValueAt(i); + final Expression expression = myTemplate.getExpressionAt(i); + final Expression defaultValue = myTemplate.getDefaultValueAt(i); String oldValue = getVariableValueText(variableName); - recalcSegment(segmentNumber, isQuick, expression, defaultValue); + DumbService.getInstance(myProject).withAlternativeResolveEnabled(new Runnable() { + @Override + public void run() { + recalcSegment(segmentNumber, isQuick, expression, defaultValue); + } + }); final TextResult value = getVariableValue(variableName); assert value != null : "name=" + variableName + "\ntext=" + myTemplate.getTemplateText(); String newValue = value.getText();