void (@NotNull PsiTreeChangeEvent e) { // local modification final PsiFile file = e.getFile(); if (file != null) { scheduleMarkFileAsDirtyAndUpdateTree(file); return; } PsiElement child = e.getChild(); if (child instanceof PsiFile psiFile) { // file will be removed scheduleMarkFileAsDirtyAndUpdateTree(psiFile); return; } if (child instanceof PsiDirectory psiDirectory) { // directory will be removed List<VirtualFile> files = myFileTree.getFiles(psiDirectory.getVirtualFile()); myCoroutineHelper.scheduleMarkFilesAsDirtyAndUpdateTree(files); } else { if (PsiTreeUtil.getParentOfType(child, PsiComment.class, false) != null) { // change inside comment scheduleMarkFileAsDirtyAndUpdateTree(child.getContainingFile()); } } }