int (final PsiElement element) { final PsiElement compStatement = getStatementList(element); final PsiElement statement = getParentRightBefore(element, compStatement); if (statement == null) { return 0; } PsiElement sibling = statement.getPrevSibling(); if (sibling == null) { sibling = compStatement.getPrevSibling(); } final String whitespace = sibling instanceof PsiWhiteSpace ? sibling.getText() : ""; final int i = whitespace.lastIndexOf("\n"); return i != -1 ? whitespace.length() - i - 1 : 0; }