SearchScope (@NotNull PsiElement element) { if (element instanceof PomTargetPsiElement) { PomTarget target = ((PomTargetPsiElement)element).getTarget(); if (target instanceof DomTarget) { DomElement domElement = ((DomTarget)target).getDomElement(); if (domElement instanceof ExtensionPoint || domElement instanceof Extension || domElement instanceof ActionOrGroup) { return getAllPluginDescriptorFilesSearchScope(element); } } } if (PsiUtil.isIdeaProject(element.getProject())) { // we use UAST to properly handle both Java and Kotlin classes var uClass = UastContextKt.toUElement(element, UClass.class); if (uClass != null && (uClass.getVisibility() == UastVisibility.PUBLIC || uClass.getVisibility() == UastVisibility.PACKAGE_LOCAL)) { return getAllPluginDescriptorFilesSearchScope(element); } } return null; }