private static PsiElement @NotNull [] getElementsIntersectingRange(@NotNull PsiFile file, int startOffset, int endOffset) {
    FileViewProvider viewProvider = file.getViewProvider();
    Set<PsiElement> result = new LinkedHashSet<>();
    for (Language language : viewProvider.getLanguages()) {
      PsiFile psiRoot = viewProvider.getPsi(language);
      if (HighlightingLevelManager.getInstance(file.getProject()).shouldInspect(psiRoot)) {
        result.addAll(CollectHighlightsUtil.getElementsInRange(psiRoot, startOffset, endOffset, true));
      }
    }
    return PsiUtilCore.toPsiElementArray(result);
  }
private static PsiElement @NotNull [] getElementsIntersectingRange(@NotNull PsiFile file, int startOffset, int endOffset)