From 7f84ec2f8ee41c998560aef2e19f54a81426c211 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 19 Apr 2011 14:48:37 +0400 Subject: [PATCH] more checkcanceled --- .../codeInsight/daemon/impl/GeneralHighlightingPass.java | 2 ++ .../psi/impl/source/tree/injected/InjectedLanguageUtil.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java index 0a3f4c394c8d..89f0839ea62e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java @@ -46,6 +46,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter; import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; @@ -498,6 +499,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP final TextAttributes defaultAttrs = myGlobalScheme.getAttributes(HighlighterColors.TEXT); for (Trinity token : tokens) { + ProgressManager.checkCanceled(); IElementType tokenType = token.getFirst(); PsiLanguageInjectionHost injectionHost = token.getSecond(); TextRange textRange = token.getThird(); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java index e9c855f6c2fb..75a24bfe3c2c 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java @@ -304,11 +304,13 @@ public class InjectedLanguageUtil { PsiFile hostPsiFile = documentManager.getPsiFile(hostDocument); assert hostPsiFile != null; for (RangeMarker rangeMarker : injected) { + ProgressManager.checkCanceled(); PsiElement element = rangeMarker.isValid() ? hostPsiFile.findElementAt(rangeMarker.getStartOffset()) : null; if (element == null) { injected.remove(rangeMarker); continue; } + ProgressManager.checkCanceled(); // it is here reparse happens and old file contents replaced enumerate(element, hostPsiFile, new PsiLanguageInjectionHost.InjectedPsiVisitor() { public void visit(@NotNull PsiFile injectedPsi, @NotNull List places) {