PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { PsiFile file = holder.getFile(); if (!(file instanceof YAMLFile)) { return PsiElementVisitor.EMPTY_VISITOR; } Collection<PsiElement> roots = YamlJsonPsiWalker.INSTANCE.getRoots(file); if (roots.isEmpty()) { return PsiElementVisitor.EMPTY_VISITOR; } JsonSchemaService service = JsonSchemaService.Impl.get(file.getProject()); VirtualFile virtualFile = file.getViewProvider().getVirtualFile(); if (!service.isApplicableToFile(virtualFile)) { return PsiElementVisitor.EMPTY_VISITOR; } final JsonSchemaObject rootSchema = service.getSchemaObject(file); if (rootSchema == null) { return PsiElementVisitor.EMPTY_VISITOR; } return doBuildVisitor(holder, session, roots, rootSchema); }