void (SimpleColoredComponent nameComponent, @NotNull List<LookupElementPresentation.DecoratedTextRange> itemNameDecorations, @NotNull LookupElement item) { if (nameComponent.getFragmentCount() == 0 || itemNameDecorations.isEmpty()) { return; } List<Integer> offsetsToSplit = itemNameDecorations.stream() .map(decoratedTextRange -> decoratedTextRange.textRange()) .flatMap(textRange -> Stream.of(textRange.getStartOffset(), textRange.getEndOffset())) .sorted() .distinct() .toList(); splitSimpleColoredComponentAtLeastByOffsets(nameComponent, offsetsToSplit); EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme(); SimpleColoredComponent.ColoredIterator iterator = nameComponent.iterator(); while (iterator.hasNext()) { iterator.next(); List<LookupElementPresentation.LookupItemDecoration> decorations = itemNameDecorations.stream() .filter(decoratedTextRange -> decoratedTextRange.textRange().intersectsStrict(iterator.getOffset(), iterator.getEndOffset())) .map(LookupElementPresentation.DecoratedTextRange::decoration) .toList(); if (decorations.isEmpty()) { continue; } for (LookupElementPresentation.LookupItemDecoration decoration : decorations) { TextAttributes newAttributes = iterator.getTextAttributes().toTextAttributes(); if (decoration == LookupElementPresentation.LookupItemDecoration.ERROR) { Color color = editorColorsScheme.getAttributes(CodeInsightColors.ERRORS_ATTRIBUTES).getEffectColor(); TextAttributesEffectsBuilder.create().coverWith(EffectType.WAVE_UNDERSCORE, color).applyTo(newAttributes); iterator.setTextAttributes(SimpleTextAttributes.fromTextAttributes(newAttributes)); } //must be last if (decoration == LookupElementPresentation.LookupItemDecoration.HIGHLIGHT_MATCHED) { SimpleTextAttributes highlighted = new SimpleTextAttributes(iterator.getTextAttributes().getStyle(), MATCHED_FOREGROUND_COLOR); iterator.setTextAttributes(highlighted); } } } }