private static void highlightRanges(@NotNull HighlightManager highlightManager,
                                     @NotNull Editor editor,
                                     @Nullable TextAttributes attributes,
                                     @Nullable TextAttributesKey attributesKey,
                                     boolean clearHighlights,
                                     @NotNull List<? extends TextRange> textRanges) {
    assert attributes != null || attributesKey != null : "Both attributes and attributesKey are null";

    if (clearHighlights) {
      clearHighlights(editor, highlightManager, textRanges, attributes, attributesKey);
      return;
    }
    ArrayList<RangeHighlighter> highlighters = new ArrayList<>();
    for (TextRange range : textRanges) {
      if (attributes != null) {
        //noinspection deprecation
        highlightManager.addRangeHighlight(editor, range.getStartOffset(), range.getEndOffset(), attributes, false, highlighters);
        continue;
      }
      highlightManager.addRangeHighlight(editor, range.getStartOffset(), range.getEndOffset(), attributesKey, false, highlighters);

    }
    for (RangeHighlighter highlighter : highlighters) {
      String tooltip = getLineTextErrorStripeTooltip(editor.getDocument(), highlighter.getStartOffset(), true);
      highlighter.setErrorStripeTooltip(tooltip);
    }
  }
private static void highlightRanges(@NotNull HighlightManager highlightManager,
                                     @NotNull Editor editor,
                                     @Nullable TextAttributes attributes,
                                     @Nullable TextAttributesKey attributesKey,
                                     boolean clearHighlights,
                                     @NotNull List<? extends TextRange> textRanges)