boolean (@NotNull PsiElement element) { PsiElement current = element instanceof JsonProperty ? element : PsiTreeUtil.getParentOfType(element, JsonProperty.class); while (current != null && current.getNode().getElementType() != JsonElementTypes.COMMA) { current = current.getNextSibling(); } int commaOffset = current == null ? Integer.MAX_VALUE : current.getTextRange().getStartOffset(); final int offset = element.getTextRange().getStartOffset(); final JsonObject object = PsiTreeUtil.getParentOfType(element, JsonObject.class); if (object != null) { for (JsonProperty property : object.getPropertyList()) { final int pOffset = property.getTextRange().getStartOffset(); if (pOffset >= offset && !PsiTreeUtil.isAncestor(property, element, false)) { return pOffset < commaOffset; } } } return false; }