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.HASH) { // { // key: value // } return Indent.getNormalIndent(); } else if (grandParentIsDocument) { // --- // key: value return SAME_AS_PARENT_INDENT; } else if (parentType == YAMLElementTypes.SEQUENCE_ITEM) { // [ // a: x, // b: y // ] return Indent.getNoneIndent(); } else { // - - a: x // b: y return DIRECT_NORMAL_INDENT; } }