boolean (PsiFile file, int caretOffset) { PsiElement element = file.findElementAt(caretOffset); if (element != null) { if (PsiUtilCore.getElementType(element) == YAMLTokenTypes.SCALAR_LIST || PsiUtilCore.getElementType(element.getParent()) == YAMLElementTypes.SCALAR_LIST_VALUE) { return false; } TokenSet ends = TokenSet.create(YAMLTokenTypes.EOL, YAMLTokenTypes.SCALAR_EOL, YAMLTokenTypes.COMMENT); IElementType nextType = PsiUtilCore.getElementType(element.getNextSibling()); if (PsiUtilCore.getElementType(element) == YAMLTokenTypes.INDENT && (nextType == null || ends.contains(nextType))) { return true; } } PsiElement previousElement; if (element == null) { if (caretOffset > 0) { previousElement = file.findElementAt(caretOffset - 1); } else { return true; } } else { previousElement = PsiTreeUtil.prevLeaf(element, true); } if (PsiUtilCore.getElementType(previousElement) == TokenType.WHITE_SPACE) previousElement = PsiTreeUtil.prevLeaf(previousElement, true); return PsiUtilCore.getElementType(previousElement) == YAMLTokenTypes.INDENT || PsiUtilCore.getElementType(previousElement) == YAMLTokenTypes.EOL || PsiUtilCore.getElementType(previousElement) == YAMLTokenTypes.SEQUENCE_MARKER; }