private Highlight @NotNull [] calcItemHighlights(@NotNull RecentLocationItem item, boolean lexerHighlights) {
    TextRange[] ranges = item.ranges;
    IdeDocumentHistoryImpl.PlaceInfo info = item.info;
    EditorColorsScheme colorsScheme = getEditor().getColorsScheme();

    RangeMarker caretPosition = item.info.getCaretPosition();
    if (caretPosition == null || !caretPosition.isValid()) {
      return Highlight.EMPTY_ARRAY;
    }

    Document fileDocument = caretPosition.getDocument();
    ArrayList<Highlight> result = new ArrayList<>();
    if (lexerHighlights) {
      EditorHighlighter editorHighlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(
        info.getFile(), colorsScheme, myProject);
      editorHighlighter.setEditor(new LightHighlighterClient(fileDocument, myProject));
      editorHighlighter.setText(fileDocument.getText());
      int rangeIdx = 0;
      int rangeOffset = 0;
      HighlighterIterator iterator = editorHighlighter.createIterator(ranges[0].getStartOffset());
      while (!iterator.atEnd() && rangeIdx < ranges.length) {
        TextRange range = ranges[rangeIdx];
        if (range.intersects(iterator.getStart(), iterator.getEnd())) {
          result.add(new Highlight(
            Math.max(iterator.getStart(), range.getStartOffset()) - range.getStartOffset() + rangeOffset,
            Math.min(iterator.getEnd(), range.getEndOffset()) - range.getStartOffset() + rangeOffset,
            iterator.getTextAttributes()));
        }
        if (iterator.getEnd() < range.getEndOffset()) {
          iterator.advance();
        }
        else {
          rangeOffset += range.getLength() + 1;
          rangeIdx++;
        }
      }
    }
    else {
      int totalStartOffset = ranges[0].getStartOffset();
      int totalEndOffset = ranges[ranges.length - 1].getEndOffset();
      DaemonCodeAnalyzerEx.processHighlights(fileDocument, myProject, null, totalStartOffset, totalEndOffset, o -> {
          if (o.getSeverity() != HighlightSeverity.INFORMATION ||
              o.getEndOffset() <= totalStartOffset ||
              o.getStartOffset() >= totalEndOffset) {
            return true;
          }
          for (int rangeIdx = 0, rangeOffset = 0; rangeIdx < ranges.length; rangeOffset += ranges[rangeIdx].getLength() + 1, rangeIdx++) {
            TextRange range = ranges[rangeIdx];
            if (range.intersects(o.getStartOffset(), o.getEndOffset())) {
              TextAttributes textAttributes = o.forcedTextAttributes != null ? o.forcedTextAttributes :
                                              colorsScheme.getAttributes(o.forcedTextAttributesKey);
              result.add(new Highlight(Math.max(o.getActualStartOffset(), range.getStartOffset()) - range.getStartOffset() + rangeOffset,
                                       Math.min(o.getActualEndOffset(), range.getEndOffset()) - range.getStartOffset() + rangeOffset,
                                       textAttributes));
            }
          }
          return true;
        });
    }
    return result.toArray(Highlight.EMPTY_ARRAY);
  }
private Highlight @NotNull [] calcItemHighlights(@NotNull RecentLocationItem item, boolean lexerHighlights)