void (final Project project, final VirtualFile vFile) { if (!vFile.isDirectory() && vFile.getFileType() instanceof LanguageFileType) { ApplicationManager.getApplication().runReadAction(() -> { PsiFile psiFile = PsiManager.getInstance(project).findFile(vFile); if (psiFile == null) return; for (PsiFile root : psiFile.getViewProvider().getAllFiles()) { root.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitComment(@NotNull PsiComment comment) { commentFound(vFile, comment.getText()); } }); } }); } }