private static void highlightTodos(@NotNull PsiFile file,
                                     @NotNull CharSequence text,
                                     @NotNull TextRange restrictRange,
                                     @NotNull HighlightInfoHolder holder) {
    PsiTodoSearchHelper helper = PsiTodoSearchHelper.getInstance(file.getProject());
    if (helper == null || !shouldHighlightTodos(helper, file)) return;
    TodoItem[] todoItems = helper.findTodoItems(file, restrictRange.getStartOffset(), restrictRange.getEndOffset());

    for (TodoItem todoItem : todoItems) {
      ProgressManager.checkCanceled();

      TodoPattern todoPattern = todoItem.getPattern();
      if (todoPattern == null) {
        continue;
      }

      TextRange textRange = todoItem.getTextRange();
      List<TextRange> additionalRanges = todoItem.getAdditionalTextRanges();

      String description = formatDescription(text, textRange, additionalRanges);
      String tooltip = XmlStringUtil.escapeString(StringUtil.shortenPathWithEllipsis(description, 1024)).replace("\n", "<br>");

      TextAttributes attributes = todoPattern.getAttributes().getTextAttributes();
      addTodoItem(holder, attributes, description, tooltip, textRange);
      if (!additionalRanges.isEmpty()) {
        TextAttributes attributesForAdditionalLines = attributes.clone();
        attributesForAdditionalLines.setErrorStripeColor(null);
        for (TextRange range: additionalRanges) {
          addTodoItem(holder, attributesForAdditionalLines, description, tooltip, range);
        }
      }
    }
  }
private static void highlightTodos(@NotNull PsiFile file,
                                     @NotNull CharSequence text,
                                     @NotNull TextRange restrictRange,
                                     @NotNull HighlightInfoHolder holder)