int (@NotNull final PsiElement elementInLine) { PsiElement currentElement = elementInLine; while (currentElement != null) { final IElementType type = currentElement.getNode().getElementType(); if (type == YAMLTokenTypes.EOL) { return 0; } if (type == YAMLTokenTypes.INDENT) { return currentElement.getTextLength(); } currentElement = PsiTreeUtil.prevLeaf(currentElement); } return 0; }