SearchScope (@NotNull VirtualFile file, @NotNull Project project) { if (ProjectRootManager.getInstance(project).getFileIndex().isInSourceContent(file)) { return null; } GradleClassFinder gradleClassFinder = PsiElementFinder.EP.findExtension(GradleClassFinder.class, project); if (gradleClassFinder == null) { return null; } final List<VirtualFile> roots = gradleClassFinder.calcClassRoots(); for (VirtualFile root : roots) { if (VfsUtilCore.isAncestor(root, file, true)) { return NonClasspathDirectoriesScope.compose(roots); } } return null; }