PsiElementVisitor (final @NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { PsiFile file = holder.getFile(); Collection<PsiElement> allRoots = JsonOriginalPsiWalker.INSTANCE.getRoots(file); // JSON may have only a single root element JsonValue root = allRoots.size() == 1 ? ObjectUtils.tryCast(ContainerUtil.getFirstItem(allRoots), JsonValue.class) : null; if (root == null) return PsiElementVisitor.EMPTY_VISITOR; JsonSchemaService service = JsonSchemaService.Impl.get(file.getProject()); VirtualFile virtualFile = file.getViewProvider().getVirtualFile(); if (!service.isApplicableToFile(virtualFile)) return PsiElementVisitor.EMPTY_VISITOR; return doBuildVisitor(root, service.getSchemaObject(file), service, holder, session); }