Package com.intellij.psi.search

Examples of com.intellij.psi.search.LocalSearchScope


  @NotNull
  public static SearchScope getUseScope(@NotNull ErlangQVarImpl o) {
    ErlangFunction function = PsiTreeUtil.getParentOfType(o, ErlangFunction.class, true);
    if (function != null) {
      return new LocalSearchScope(function);
    }
    return ResolveScopeManager.getElementUseScope(o);
  }
View Full Code Here


public class ErlangUnusedTypeInspection extends ErlangInspectionBase {
  @Override
  protected void checkFile(@NotNull ErlangFile file, @NotNull final ProblemsHolder problemsHolder) {
    for (ErlangTypeDefinition o : file.getTypes()) {
      Query<PsiReference> search = ReferencesSearch.search(o, new LocalSearchScope(o.getContainingFile()));
      if (search.findFirst() == null) {
        problemsHolder.registerProblem(o.getNameIdentifier(),
          "Unused function " + "'" + o.getName() + "'",
          ProblemHighlightType.LIKE_UNUSED_SYMBOL,
          new ErlangRemoveTypeFix(),
View Full Code Here

          public void visitQVar(@NotNull ErlangQVar o) {
            if (!isForceSkipped(o) && !isMacros(o) && (inArgumentDefinition(o) && !inArgumentList(o) || inLeftPartOfAssignment(o))) {
              PsiReference reference = o.getReference();
              PsiElement resolve = reference != null ? reference.resolve() : null;
              if (resolve == null) {
                Query<PsiReference> search = ReferencesSearch.search(o, new LocalSearchScope(functionClause));
                for (PsiReference ref : search) {
                  PsiElement element = ref.getElement();
                  if (ErlangPsiImplUtil.fromTheSameCaseExpression(o, element)) {
                    PsiReference reference1 = element.getReference();
                    if (reference1 == null || reference1.resolve() == null) continue;
View Full Code Here

    }
  }

  public static boolean isUnusedFunction(@NotNull ErlangFile file, @NotNull final ErlangFunction function) {
    if (ErlangPsiImplUtil.isEunitImported(file) && ErlangPsiImplUtil.isEunitTestFunction(function)) return false;
    LocalSearchScope scope = new LocalSearchScope(file);
    List<PsiReference> refs = ContainerUtil.filter(ReferencesSearch.search(function, scope).findAll(), new Condition<PsiReference>() { // filtered specs out
      @Override
      public boolean value(PsiReference psiReference) {
        PsiElement element = psiReference.getElement();
        return PsiTreeUtil.getParentOfType(element, ErlangSpecification.class) == null && !ErlangPsiImplUtil.isRecursiveCall(element, function);
View Full Code Here

TOP

Related Classes of com.intellij.psi.search.LocalSearchScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.