mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't advertise Quick Definition when completion doesn't contain psi items (IDEA-87208)
This commit is contained in:
+8
-3
@@ -121,6 +121,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
};
|
||||
private volatile int myCount;
|
||||
private volatile boolean myHasPsiElements;
|
||||
private boolean myLookupUpdated;
|
||||
private final ConcurrentHashMap<LookupElement, CompletionSorterImpl> myItemSorters =
|
||||
new ConcurrentHashMap<LookupElement, CompletionSorterImpl>(
|
||||
@@ -320,7 +321,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
|
||||
if (!myLookupUpdated) {
|
||||
if (myLookup.getAdvertisements().isEmpty() && !isAutopopupCompletion() && !DumbService.isDumb(getProject())) {
|
||||
DefaultCompletionContributor.addDefaultAdvertisements(myParameters, myLookup);
|
||||
DefaultCompletionContributor.addDefaultAdvertisements(myParameters, myLookup, myHasPsiElements);
|
||||
}
|
||||
myLookup.getAdvertiser().showRandomText();
|
||||
}
|
||||
@@ -380,8 +381,12 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
|
||||
LOG.assertTrue(myParameters.getPosition().isValid());
|
||||
|
||||
myItemSorters.put(item.getLookupElement(), (CompletionSorterImpl)item.getSorter());
|
||||
if (!myLookup.addItem(item.getLookupElement(), item.getPrefixMatcher())) {
|
||||
LookupElement lookupElement = item.getLookupElement();
|
||||
if (!myHasPsiElements && lookupElement.getPsiElement() != null) {
|
||||
myHasPsiElements = true;
|
||||
}
|
||||
myItemSorters.put(lookupElement, (CompletionSorterImpl)item.getSorter());
|
||||
if (!myLookup.addItem(lookupElement, item.getPrefixMatcher())) {
|
||||
return;
|
||||
}
|
||||
myCount++;
|
||||
|
||||
+3
-8
@@ -30,17 +30,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class DefaultCompletionContributor extends CompletionContributor {
|
||||
|
||||
static void addDefaultAdvertisements(@NotNull final CompletionParameters parameters, LookupImpl lookup) {
|
||||
static void addDefaultAdvertisements(@NotNull final CompletionParameters parameters, LookupImpl lookup, boolean includePsiFeatures) {
|
||||
if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_DOT_ETC)) {
|
||||
lookup.addAdvertisement(LangBundle.message("completion.dot.etc.ad"), null);
|
||||
}
|
||||
if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_SMART_ENTER)) {
|
||||
final String shortcut = getActionShortcut(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_COMPLETE_STATEMENT);
|
||||
if (shortcut != null) {
|
||||
lookup.addAdvertisement(LangBundle.message("completion.smart.enter.ad", shortcut), null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!includePsiFeatures) return;
|
||||
|
||||
if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_SMART_ENTER)) {
|
||||
final String shortcut = getActionShortcut(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_COMPLETE_STATEMENT);
|
||||
if (shortcut != null) {
|
||||
|
||||
Reference in New Issue
Block a user