List<PsiElement> (@NotNull Project project, @NotNull UastMetaLanguage jvmLanguage, @NotNull VirtualFile file) { if (DumbService.isDumb(project) || project.isDisposed() || !file.isValid()) return null; ProjectFileIndex index = ProjectFileIndex.getInstance(project); if (!index.isInSource(file)) return null; PsiFile psiFile = PsiManager.getInstance(project).findFile(file); if (psiFile == null || !jvmLanguage.matchesLanguage(psiFile.getLanguage())) return null; Document document = FileDocumentManager.getInstance().getDocument(file); if (document == null) return null; List<PsiElement> physicalMethods = new SmartList<>(); psiFile.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { UMethod method = UastContextKt.toUElement(element, UMethod.class); if (method != null) { ContainerUtil.addAllNotNull(physicalMethods, method.getSourcePsi()); } super.visitElement(element); } }); return physicalMethods; }