@Override
      public void visitElement(@NotNull PsiElement element) {
        if (!selection.intersects(element.getTextRange())) {
          return;
        }
        if (filter.isInstance(element)) {
          results.add(filter.cast(element));
          if (!searchChildrenOfFound) {
            return;
          }
        }
        super.visitElement(element);
      }
@Override
      public void visitElement(@NotNull PsiElement element)