From 7d31929fbe24b64d3d30ebae3a29b444f1e5bfaa Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 22 Nov 2011 15:04:50 +0100 Subject: [PATCH] don't fill common prefix for a lookup which couldn't be shown (EA-31744) --- .../completion/CodeCompletionHandlerBase.java | 3 +-- .../completion/CompletionProgressIndicator.java | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index e752cb59a49a..04fdb13567ea 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -474,8 +474,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { if (decision == AutoCompletionDecision.SHOW_LOOKUP) { CompletionServiceImpl.setCompletionPhase(new CompletionPhase.ItemsCalculated(indicator)); indicator.getLookup().setCalculating(false); - indicator.showLookup(); - if (isAutocompleteCommonPrefixOnInvocation() && items.length > 1) { + if (indicator.showLookup() && isAutocompleteCommonPrefixOnInvocation() && items.length > 1) { indicator.fillInCommonPrefix(false); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java index 96e49d55dc02..1d7a85c4c861 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -304,8 +304,8 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement return "Completion" + hashCode(); } - public void showLookup() { - updateLookup(); + public boolean showLookup() { + return updateLookup(); } public CompletionParameters getParameters() { @@ -320,14 +320,14 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement return myLookup; } - private void updateLookup() { + private boolean updateLookup() { ApplicationManager.getApplication().assertIsDispatchThread(); - if (isOutdated()) return; + if (isOutdated()) return false; boolean justShown = false; if (!myLookup.isShown() && shouldShowLookup()) { if (hideAutopopupIfMeaningless()) { - return; + return false; } if (StringUtil.isEmpty(myLookup.getAdvertisementText()) && !isAutopopupCompletion()) { @@ -338,7 +338,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement } if (!myLookup.showLookup()) { - return; + return false; } justShown = true; } @@ -347,6 +347,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement if (justShown) { myLookup.ensureSelectionVisible(); } + return true; } private boolean shouldShowLookup() {