private static boolean bodyIsIndented(@NotNull PsiElement loop, @NotNull PsiElement body) {
    PsiWhiteSpace beforeBody = ObjectUtils.tryCast(body.getPrevSibling(), PsiWhiteSpace.class);
    if (beforeBody == null) return false;
    PsiWhiteSpace beforeLoop = ObjectUtils.tryCast(loop.getPrevSibling(), PsiWhiteSpace.class);
    if (beforeLoop == null) return false;
    String beforeBodyText = beforeBody.getText();
    String beforeLoopText = beforeLoop.getText();
    int beforeBodyLineBreak = beforeBodyText.lastIndexOf('\n');
    if (beforeBodyLineBreak == -1) return false;
    int beforeLoopLineBreak = beforeLoopText.lastIndexOf('\n');
    if (beforeLoopLineBreak == -1) return false;
    return beforeBodyText.length() - beforeBodyLineBreak > beforeLoopText.length() - beforeLoopLineBreak;
  }
private static boolean bodyIsIndented(@NotNull PsiElement loop, @NotNull PsiElement body)