completion results are available only after the completion progress has finished...
authorpeter <peter@jetbrains.com>
Tue, 31 Jan 2012 19:32:40 +0000 (20:32 +0100)
committerpeter <peter@jetbrains.com>
Tue, 31 Jan 2012 19:44:46 +0000 (20:44 +0100)
platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java

index 6ff52c50a8373ff6a6c5871b101a04a8e0d45e67..3bd5e56306ad071d202f06a5d6ad7f0f20040fab 100644 (file)
@@ -329,6 +329,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
     final Runnable computeRunnable = new Runnable() {
       @Override
       public void run() {
+        final AtomicReference<LookupElement[]> data1 = new AtomicReference<LookupElement[]>(null);
         ProgressManager.getInstance().runProcess(new Runnable() {
           @Override
           public void run() {
@@ -342,7 +343,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
                   indicator.duringCompletion(initContext);
                   ProgressManager.checkCanceled();
 
-                  data.set(CompletionService.getCompletionService().performCompletion(parameters, new Consumer<CompletionResult>() {
+                  data1.set(CompletionService.getCompletionService().performCompletion(parameters, new Consumer<CompletionResult>() {
                     @Override
                     public void consume(final CompletionResult result) {
                       indicator.addItem(result);
@@ -355,6 +356,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
             }
           }
         }, indicator);
+        data.set(data1.get());
       }
     };