void (@NotNull EditorEx editor) { String completionShortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION)); if (!StringUtil.isEmpty(completionShortcutText)) { final Ref<Boolean> toShowHintRef = new Ref<>(true); editor.getDocument().addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent e) { toShowHintRef.set(false); } }); editor.addFocusListener(new FocusChangeListener() { @Override public void focusGained(final @NotNull Editor editor) { if (Boolean.TRUE.equals(editor.getUserData(AutoPopupController.AUTO_POPUP_ON_FOCUS_GAINED))) { AutoPopupController.getInstance(editor.getProject()).scheduleAutoPopup(editor); return; } if (toShowHintRef.get() && editor.getDocument().getText().isEmpty() && !hasValidationInfo(editor)) { ApplicationManager.getApplication().invokeLater( () -> HintManager.getInstance().showInformationHint(editor, LangBundle.message("hint.text.code.completion.available", completionShortcutText))); } } private static boolean hasValidationInfo(@NotNull Editor editor) { for (Component parent : UIUtil.uiParents(editor.getComponent(), false)) { if (parent instanceof JComponent) { ComponentValidator validator = ComponentValidator.getInstance((JComponent)parent).orElse(null); if (validator != null && validator.getValidationInfo() != null) { return true; } } } return false; } }); } }