How do I find PsiElements of any type conditionally in a project?
Answered
I tried to find any utilities like Searchers of Finders, but no luck.
Here are some examples:
- find all psi literals -> condition: literal in a specific psi method call parameter
- find all psi methods -> condition: annotated with specific psi annotation
- find all psi fields -> condition: of specific type
I have found a search solution for methods:
AnnotatedElementsSearch
.searchPsiMethods(annotationClass, myElement.getResolveScope())
.findAll();
But for other cases no utils found.
Please sign in to leave a comment.
Hi Serhii,
Not all search cases are implemented. You can browse what is implemented by checking subclasses of com.intellij.psi.search.searches.ExtensibleQueryFactory.
Looked into it - yes that is for sure no enough for my edge cases. Nevermind, I will look for other solutions.