From b238ba6e1e273a3b4914ebe624cdcb144a2f1b8a Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 30 Sep 2024 16:16:18 +0200 Subject: [PATCH] optimization: do not create ShowIntentionPass for canceled indicator GitOrigin-RevId: be496653a993faed8250f0e7d17e4c340885ec46 --- .../daemon/impl/TextEditorHighlightingPassRegistrarImpl.java | 2 ++ .../intellij/codeInsight/daemon/impl/PassExecutorService.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/TextEditorHighlightingPassRegistrarImpl.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/TextEditorHighlightingPassRegistrarImpl.java index 77fa8a791ae3..140637bbf20e 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/TextEditorHighlightingPassRegistrarImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/TextEditorHighlightingPassRegistrarImpl.java @@ -13,6 +13,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.ExtensionPointListener; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.PluginDescriptor; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiCompiledElement; @@ -177,6 +178,7 @@ public final class TextEditorHighlightingPassRegistrarImpl extends TextEditorHig IntList passesRefusedToCreate = new IntArrayList(); try (AccessToken ignored = ClientId.withExplicitClientId(ClientEditorManager.Companion.getClientId(editor))) { for (int passId = 1; passId < frozenPassConfigs.length; passId++) { + ProgressManager.checkCanceled(); PassConfig passConfig = frozenPassConfigs[passId]; if (passConfig == null) continue; if (ArrayUtil.find(passesToIgnore, passId) != -1) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java index f5b381be2252..c17c774fefd8 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java @@ -265,6 +265,7 @@ final class PassExecutorService implements Disposable { @NotNull List dependentPasses, @NotNull DaemonProgressIndicator updateProgress, @NotNull AtomicInteger threadsToStartCountdown) { + ProgressManager.checkCanceled(); int passId = pass.getId(); ScheduledPass scheduledPass = toBeSubmitted.get(passId); if (scheduledPass != null) return scheduledPass; @@ -295,6 +296,7 @@ final class PassExecutorService implements Disposable { } if (pass.isRunIntentionPassAfter() && fileEditor instanceof TextEditor text) { + ProgressManager.checkCanceled(); Editor editor = text.getEditor(); ShowIntentionsPass ip = new ShowIntentionsPass(psiFile, editor, false); assignUniqueId(ip, id2Pass);