private void queueElement(@NotNull PsiElement child, boolean whitespaceOptimizationAllowed, @NotNull PsiTreeChangeEvent event) {
    ApplicationManager.getApplication().assertWriteIntentLockAcquired();
    PsiFile psiFile = event.getFile();
    if (psiFile == null) psiFile = child.getContainingFile();
    if (psiFile == null) {
      myFileStatusMap.markAllFilesDirty(child);
      return;
    }

    if (!child.isValid()) return;

    PsiDocumentManagerImpl pdm = (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(myProject);
    Document document = pdm.getCachedDocument(psiFile);
    if (document != null) {
      VirtualFile virtualFile = psiFile.getVirtualFile();
      if (virtualFile != null && ProjectFileIndex.getInstance(myProject).isExcluded(virtualFile)) {
        // ignore changes in excluded files
        return;
      }
      if (pdm.getSynchronizer().getTransaction(document) == null) {
        // content reload, language level change or some other big change
        myFileStatusMap.markAllFilesDirty(child);
        return;
      }

      List<Change> toUpdate = changedElements.computeIfAbsent(document, __->new SmartList<>());
      toUpdate.add(new Change(child, whitespaceOptimizationAllowed, wasReferenceChanged(event)));
    }
  }
private void queueElement(@NotNull PsiElement child, boolean whitespaceOptimizationAllowed, @NotNull PsiTreeChangeEvent event)