private boolean isInScope(@NotNull RefEntity refEntity) {
        if (refEntity instanceof RefElement) {
          SmartPsiElementPointer pointer = ((RefElement)refEntity).getPointer();
          if (pointer != null) {
            VirtualFile virtualFile = pointer.getVirtualFile();
            if (virtualFile != null && !scope.contains(virtualFile)) return false;
          }
          else {
            RefEntity owner = refEntity.getOwner();
            return owner == null || isInScope(owner);
          }
        }
        if (refEntity instanceof RefModule) {
          return scope.containsModule(((RefModule)refEntity).getModule());
        }
        return true;
      }
private boolean isInScope(@NotNull RefEntity refEntity)