void (final PsiElement childByRole, final HighlightInfoType warning, @NotNull @InspectionMessage String localizedMessage, IntentionAction... quickFixActions) { if(childByRole != null) { final TextRange textRange = childByRole.getTextRange(); int length = textRange.getLength(); final int startOffset = textRange.getStartOffset(); HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(warning).range(childByRole, startOffset, startOffset + length) .descriptionAndTooltip(localizedMessage); for (final IntentionAction quickFixAction : quickFixActions) { builder.registerFix(quickFixAction, null, null, textRange, null); } HighlightInfo highlightInfo = builder.create(); if (highlightInfo == null) { builder = HighlightInfo.newHighlightInfo(warning).range(new TextRange(startOffset, startOffset + length)) .textAttributes(Holder.NONEMPTY_TEXT_ATTRIBUTES); for (final IntentionAction quickFixAction : quickFixActions) { builder.registerFix(quickFixAction, null, null, textRange, null); } highlightInfo = builder.descriptionAndTooltip(localizedMessage).create(); } myHolder.add(highlightInfo); } }