HighlightInfo (@NotNull PsiElement resolved, @NotNull PsiJavaCodeReferenceElement elementToHighlight, @NotNull TextAttributesScheme scheme) { PsiElement referenceNameElement = elementToHighlight.getReferenceNameElement(); TextRange range; if (referenceNameElement == null) { range = elementToHighlight.getTextRange(); } else { PsiElement nextSibling = PsiTreeUtil.nextLeaf(referenceNameElement); if (nextSibling != null && nextSibling.getTextRange().isEmpty()) { // empty PsiReferenceParameterList nextSibling = PsiTreeUtil.nextLeaf(nextSibling); } if (PsiUtil.isJavaToken(nextSibling, JavaTokenType.DOT)) { range = new TextRange(referenceNameElement.getTextRange().getStartOffset(), nextSibling.getTextRange().getEndOffset()); } else { range = referenceNameElement.getTextRange(); } } HighlightInfoType type = JavaHighlightInfoTypes.CLASS_NAME; TextAttributes attributes = mergeWithScopeAttributes(resolved, type, scheme); HighlightInfo.Builder builder = nameBuilder(type).range(range); if (attributes != null) { builder.textAttributes(attributes); } return builder.createUnconditionally(); }