void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { List<JsonLiteralChecker> extensions = JsonLiteralChecker.EP_NAME.getExtensionList(); if (element instanceof JsonReferenceExpression) { highlightPropertyKey(element, holder); } else if (element instanceof JsonStringLiteral stringLiteral) { final int elementOffset = element.getTextOffset(); highlightPropertyKey(element, holder); final String text = JsonPsiUtil.getElementTextWithoutHostEscaping(element); final int length = text.length(); // Check that string literal is closed properly if (length <= 1 || text.charAt(0) != text.charAt(length - 1) || JsonPsiUtil.isEscapedChar(text, length - 1)) { holder.newAnnotation(HighlightSeverity.ERROR, JsonBundle.message("syntax.error.missing.closing.quote")).create(); } // Check escapes final List<Pair<TextRange, String>> fragments = stringLiteral.getTextFragments(); for (Pair<TextRange, String> fragment: fragments) { for (JsonLiteralChecker checker: extensions) { if (!checker.isApplicable(element)) continue; Pair<TextRange, @InspectionMessage String> error = checker.getErrorForStringFragment(fragment, stringLiteral); if (error != null) { holder.newAnnotation(HighlightSeverity.ERROR, error.second).range(error.getFirst().shiftRight(elementOffset)).create(); } } } } else if (element instanceof JsonNumberLiteral) { String text = null; for (JsonLiteralChecker checker: extensions) { if (!checker.isApplicable(element)) continue; if (text == null) { text = JsonPsiUtil.getElementTextWithoutHostEscaping(element); } String error = checker.getErrorForNumericLiteral(text); if (error != null) { holder.newAnnotation(HighlightSeverity.ERROR, error).create(); } } } }