public static void setupFoldingsAndHighlightProblems(@NotNull EditorEx editor, @NotNull Container editorContainer,
                                                       @NotNull List<? extends UsageInfo> usages, @NotNull Project project) {
    final Document doc = editor.getDocument();
    PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
    InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(project);
    if (documentManager.isUncommited(doc)) {
      WriteAction.run(() -> documentManager.commitDocument(doc));
    }
    if (usages.size() > 1) {
      SortedSet<PreviewEditorFoldingRegion> foldingRegions = new TreeSet<>();
      foldingRegions.add(new PreviewEditorFoldingRegion(0, doc.getLineCount()));
      boolean isUpdated = false;
      for (UsageInfo usage : usages) {
        if (usage == null) {
          return;
        }
        PsiElement element = usage.getElement();
        Segment segment = usage.getSegment();
        assert element != null;
        isUpdated |= makeVisible(foldingRegions, injectedLanguageManager.injectedToHost(element, segment != null ? TextRange.create(segment)
                                                                                                                 : element.getTextRange()), doc);
      }
      if (isUpdated) {
        setupFoldings(editor, foldingRegions);
      }
    }

    highlightProblems(editor, editorContainer, usages, project);
  }
public static void setupFoldingsAndHighlightProblems(@NotNull EditorEx editor, @NotNull Container editorContainer,
                                                       @NotNull List<? extends UsageInfo> usages, @NotNull Project project)