private HighlightInfo.Builder highlightInfoFromDescriptor(@NotNull ProblemDescriptor problemDescriptor,
                                                            @NotNull HighlightInfoType highlightInfoType,
                                                            @NotNull @NlsContexts.DetailedDescription String message,
                                                            @Nullable @NlsContexts.Tooltip String toolTip,
                                                            @NotNull PsiElement psiElement,
                                                            @NotNull List<? extends IntentionAction> quickFixes,
                                                            @NotNull HighlightDisplayKey key,
                                                            @Nullable EditorColorsScheme editorColorsScheme,
                                                            @NotNull SeverityRegistrar severityRegistrar) {
    TextRange textRange = ((ProblemDescriptorBase)problemDescriptor).getTextRange();
    if (textRange == null) return null;
    boolean isFileLevel = psiElement instanceof PsiFile && textRange.equals(psiElement.getTextRange());

    HighlightSeverity severity = highlightInfoType.getSeverity(psiElement);
    TextAttributesKey attributesKey = ((ProblemDescriptorBase)problemDescriptor).getEnforcedTextAttributes();
    if (problemDescriptor.getHighlightType() == ProblemHighlightType.GENERIC_ERROR_OR_WARNING && attributesKey == null) {
      attributesKey = myProfileWrapper.getInspectionProfile().getEditorAttributes(key.toString(), getFile());
    }
    TextAttributes attributes = attributesKey == null || editorColorsScheme == null || severity.getName().equals(attributesKey.getExternalName())
                                ? severityRegistrar.getTextAttributesBySeverity(severity)
                                : editorColorsScheme.getAttributes(attributesKey);
    if (attributesKey != null && (attributes == null || attributes.isEmpty())) {
      attributes = severityRegistrar.getCustomSeverityTextAttributes(attributesKey);
    }
    HighlightInfo.Builder b = HighlightInfo.newHighlightInfo(highlightInfoType)
      .range(psiElement, textRange.getStartOffset(), textRange.getEndOffset())
      .description(message)
      .severity(severity);
    if (toolTip != null) b.escapedToolTip(toolTip);
    if (HighlightSeverity.INFORMATION.equals(severity) && attributes == null && toolTip == null && !quickFixes.isEmpty()) {
      // Hack to avoid filtering this info out in HighlightInfoFilterImpl even though its attributes are empty.
      // But it has quick fixes, so it needs to be created.
      attributes = NONEMPTY_TEXT_ATTRIBUTES;
    }
    if (attributesKey != null) b.textAttributes(attributesKey);
    if (attributes != null) b.textAttributes(attributes);
    if (problemDescriptor.isAfterEndOfLine()) b.endOfLine();
    if (isFileLevel) b.fileLevelAnnotation();
    if (problemDescriptor.getProblemGroup() != null) b.problemGroup(problemDescriptor.getProblemGroup());

    return b;
  }
private HighlightInfo.Builder highlightInfoFromDescriptor(@NotNull ProblemDescriptor problemDescriptor,
                                                            @NotNull HighlightInfoType highlightInfoType,
                                                            @NotNull @NlsContexts.DetailedDescription String message,
                                                            @Nullable @NlsContexts.Tooltip String toolTip,
                                                            @NotNull PsiElement psiElement,
                                                            @NotNull List<? extends IntentionAction> quickFixes,
                                                            @NotNull HighlightDisplayKey key,
                                                            @Nullable EditorColorsScheme editorColorsScheme,
                                                            @NotNull SeverityRegistrar severityRegistrar)