com.intellij.psi.search.SearchRequestCollector Java Examples

The following examples show how to use com.intellij.psi.search.SearchRequestCollector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DotEnvReferencesSearcher.java    From idea-php-dotenv-plugin with MIT License 5 votes vote down vote up
private static void addPropertyUsages(@NotNull DotEnvProperty property, @NotNull SearchScope scope, @NotNull SearchRequestCollector collector) {
    final String propertyName = property.getName();
    if (StringUtil.isNotEmpty(propertyName)) {
        /*SearchScope additional = GlobalSearchScope.EMPTY_SCOPE;
        for (CustomPropertyScopeProvider provider : CustomPropertyScopeProvider.EP_NAME.getExtensionList()) {
            additional = additional.union(provider.getScope(property.getProject()));
        }

        SearchScope propScope = scope.intersectWith(property.getUseScope()).intersectWith(additional);*/
        collector.searchWord(propertyName, scope, UsageSearchContext.ANY, true, property);
        collector.searchWord("process.env." + propertyName, scope, UsageSearchContext.ANY, true, property);
    }
}
 
Example #2
Source File: LombokReferenceSearcher.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void processPsiField(final PsiField refPsiField, final SearchRequestCollector collector) {
  final PsiClass containingClass = refPsiField.getContainingClass();
  if (null != containingClass) {
    processClassMethods(refPsiField, collector, containingClass);

    final PsiClass[] innerClasses = containingClass.getInnerClasses();
    Arrays.stream(innerClasses)
      .forEach(psiClass -> processClassMethods(refPsiField, collector, psiClass));

    Arrays.stream(innerClasses)
      .forEach(psiClass -> processClassFields(refPsiField, collector, psiClass));
  }
}
 
Example #3
Source File: LombokReferenceSearcher.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void processClassMethods(PsiField refPsiField, SearchRequestCollector collector, PsiClass containingClass) {
  Arrays.stream(containingClass.getMethods())
    .filter(LombokLightMethodBuilder.class::isInstance)
    .filter(psiMethod -> psiMethod.getNavigationElement() == refPsiField)
    .forEach(psiMethod -> {
      collector.searchWord(psiMethod.getName(), psiMethod.getUseScope(), UsageSearchContext.IN_CODE, true, psiMethod);
    });
}
 
Example #4
Source File: LombokReferenceSearcher.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void processClassFields(PsiField refPsiField, SearchRequestCollector collector, PsiClass containingClass) {
  Arrays.stream(containingClass.getFields())
    .filter(LombokLightFieldBuilder.class::isInstance)
    .filter(psiField -> psiField.getNavigationElement() == refPsiField)
    .filter(psiField -> Objects.nonNull(psiField.getName()))
    .forEach(psiField -> {
      collector.searchWord(psiField.getName(), psiField.getUseScope(), UsageSearchContext.IN_CODE, true, psiField);
    });
}