JsonValueAdapter (@NotNull PsiElement context, boolean pinSelf) { if (context instanceof YAMLKeyValue && ((YAMLKeyValue)context).getValue() == null) { PsiElement next = PsiTreeUtil.skipWhitespacesAndCommentsForward(context); if (PsiUtilCore.getElementType(next) == YAMLTokenTypes.EOL) { next = PsiTreeUtil.skipWhitespacesAndCommentsForward(next); if (PsiUtilCore.getElementType(next) == YAMLTokenTypes.INDENT && !(PsiTreeUtil.skipWhitespacesAndCommentsForward(next) instanceof YAMLKeyValue)) { // potentially empty object after newline+indent return new YamlEmptyObjectAdapter(next); } } } PsiElement nextSibling = context.getNextSibling(); PsiElement nodeToHighlight = PsiUtilCore.getElementType(nextSibling) == TokenType.WHITE_SPACE ? nextSibling : (pinSelf ? context : context.getLastChild()); return nodeToHighlight == null ? null : new YamlEmptyValueAdapter(nodeToHighlight); }