diff --git a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java index eda28c14cd3e..88c39803f21b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java @@ -56,6 +56,7 @@ public class AutoPopupController implements Disposable { * This doesn't affect other conditions when autopopup is not possible (e.g. power save mode). */ public static final Key ALWAYS_AUTO_POPUP = Key.create("Always Show Completion Auto-Popup"); + public static final Key ALWAYS_AUTO_POPUP_NO_ADS = Key.create("Always Show Completion Auto-Popup"); private final Project myProject; private final Alarm myAlarm = new Alarm(); @@ -103,7 +104,7 @@ public class AutoPopupController implements Disposable { return; } - boolean alwaysAutoPopup = editor != null && Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP)); + boolean alwaysAutoPopup = editor != null && (Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP)) || Boolean.TRUE.equals(editor.getUserData(ALWAYS_AUTO_POPUP_NO_ADS))); if (!CodeInsightSettings.getInstance().AUTO_POPUP_COMPLETION_LOOKUP && !alwaysAutoPopup) { return; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index d1b837a78104..7f93a57989eb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -16,6 +16,7 @@ package com.intellij.codeInsight.lookup.impl; +import com.intellij.codeInsight.AutoPopupController; import com.intellij.codeInsight.FileModificationService; import com.intellij.codeInsight.completion.*; import com.intellij.codeInsight.completion.impl.CamelHumpMatcher; @@ -682,6 +683,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable } myAdComponent.showRandomText(); + if (Boolean.TRUE.equals(myEditor.getUserData(AutoPopupController.ALWAYS_AUTO_POPUP_NO_ADS))) { + myAdComponent.clearAdvertisements(); + } myUi = new LookupUi(this, myAdComponent, myList, myProject); myUi.setCalculating(myCalculating); diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index 41b9e19ed541..ea40febaeb69 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -16,6 +16,7 @@ package com.intellij.find.impl; import com.intellij.CommonBundle; +import com.intellij.codeInsight.AutoPopupController; import com.intellij.find.*; import com.intellij.find.actions.ShowUsagesAction; import com.intellij.icons.AllIcons; @@ -29,6 +30,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.event.DocumentListener; +import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.help.HelpManager; import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.progress.ProgressIndicator; @@ -311,6 +313,13 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider { super.setEnabled(enabled); setBackground(enabled ? JBColor.background() : UIUtil.getComboBoxDisabledBackground()); } + + @Override + protected EditorEx createEditor() { + EditorEx editor = super.createEditor(); + editor.putUserData(AutoPopupController.ALWAYS_AUTO_POPUP_NO_ADS, Boolean.TRUE); + return editor; + } }; myFileMaskField.setPreferredWidth(JBUI.scale(100)); myFileMaskField.addDocumentListener(new DocumentListener() { diff --git a/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java b/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java index 868c74f61327..b2f809cc0474 100644 --- a/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java +++ b/platform/lang-impl/src/com/intellij/util/textCompletion/TextCompletionUtil.java @@ -15,6 +15,7 @@ */ package com.intellij.util.textCompletion; +import com.intellij.codeInsight.AutoPopupController; import com.intellij.codeInsight.hint.HintManager; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.IdeActions; @@ -69,6 +70,10 @@ public class TextCompletionUtil { editor.addFocusListener(new FocusChangeListener() { @Override public void focusGained(final Editor editor) { + if (Boolean.TRUE.equals(editor.getUserData(AutoPopupController.ALWAYS_AUTO_POPUP_NO_ADS))) { + AutoPopupController.getInstance(editor.getProject()).scheduleAutoPopup(editor); + return; + } if (toShowHintRef.get() && editor.getDocument().getText().isEmpty()) { ApplicationManager.getApplication().invokeLater( () -> HintManager.getInstance().showInformationHint(editor, "Code completion available ( " + completionShortcutText + " )"));