@NotNull public static LookupElement highlightIfNeeded( @Nullable PsiType qualifierType, @NotNull LookupElement item, @NotNull Object object, @NotNull PsiElement place) { if (shouldMarkRed(object, place)) { return PrioritizedLookupElement.withExplicitProximity( LookupElementDecorator.withRenderer( item, new LookupElementRenderer<LookupElementDecorator<LookupElement>>() { @Override public void renderElement( LookupElementDecorator<LookupElement> element, LookupElementPresentation presentation) { element.getDelegate().renderElement(presentation); presentation.setItemTextForeground(JBColor.RED); } }), -1); } if (containsMember(qualifierType, object)) { LookupElementRenderer<LookupElementDecorator<LookupElement>> boldRenderer = new LookupElementRenderer<LookupElementDecorator<LookupElement>>() { @Override public void renderElement( LookupElementDecorator<LookupElement> element, LookupElementPresentation presentation) { element.getDelegate().renderElement(presentation); presentation.setItemTextBold(true); } }; return PrioritizedLookupElement.withExplicitProximity( LookupElementDecorator.withRenderer(item, boldRenderer), 1); } return item; }