Indent (@NotNull ASTNode node) { IElementType parentType = PsiUtilCore.getElementType(node.getTreeParent()); IElementType grandParentType = parentType == null ? null : PsiUtilCore.getElementType(node.getTreeParent().getTreeParent()); boolean grandParentIsDocument = grandParentType == YAMLElementTypes.DOCUMENT; if (parentType == YAMLElementTypes.ARRAY) { return Indent.getNormalIndent(); } else if (grandParentType == YAMLElementTypes.KEY_VALUE_PAIR) { if (shouldIndentSequenceValue) { // key: // - x // - y return DIRECT_NORMAL_INDENT; } else { // key: // - x // - y return SAME_AS_PARENT_INDENT; } } else if (grandParentIsDocument) { return SAME_AS_PARENT_INDENT; } else { // - - x // - y // or // - // - x // - y return DIRECT_NORMAL_INDENT; } }