honor completion contributor dumb-awareness (EA-64053)
authorpeter <peter@jetbrains.com>
Mon, 9 Feb 2015 14:52:13 +0000 (15:52 +0100)
committerpeter <peter@jetbrains.com>
Mon, 9 Feb 2015 15:26:06 +0000 (16:26 +0100)
platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java
platform/lang-api/src/com/intellij/codeInsight/completion/CompletionService.java

index 2329e07f74012322926eceb820ccbefb8611c773..b6485d6c5432c552ad159ca8ff7dfd7269a118c1 100644 (file)
@@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.keymap.KeymapUtil;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.KeyedExtensionCollector;
 import com.intellij.openapi.util.Pair;
@@ -234,7 +235,9 @@ public abstract class CompletionContributor {
     return ApplicationManager.getApplication().runReadAction(new Computable<List<CompletionContributor>>() {
       @Override
       public List<CompletionContributor> compute() {
-        return forLanguage(PsiUtilCore.getLanguageAtOffset(parameters.getPosition().getContainingFile(), parameters.getOffset()));
+        PsiElement position = parameters.getPosition();
+        List<CompletionContributor> all = forLanguage(PsiUtilCore.getLanguageAtOffset(position.getContainingFile(), parameters.getOffset()));
+        return DumbService.getInstance(position.getProject()).filterByDumbAwareness(all);
       }
     });
   }
index 282082a0d4a405177018a01c44ff7000abad8ae1..cfc2e27a817988743ce60faa81cccfb0a048f495 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.completion;
 
 import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.util.Key;
 import com.intellij.psi.Weigher;
 import com.intellij.util.Consumer;
@@ -74,11 +73,9 @@ public abstract class CompletionService {
                                           @Nullable final CompletionContributor from,
                                           final Consumer<CompletionResult> consumer) {
     final List<CompletionContributor> contributors = CompletionContributor.forParameters(parameters);
-    final boolean dumb = DumbService.getInstance(parameters.getPosition().getProject()).isDumb();
 
     for (int i = contributors.indexOf(from) + 1; i < contributors.size(); i++) {
       final CompletionContributor contributor = contributors.get(i);
-      if (dumb && !DumbService.isDumbAware(contributor)) continue;
 
       final CompletionResultSet result = createResultSet(parameters, consumer, contributor);
       contributor.fillCompletionVariants(parameters, result);