void (@NotNull final PsiExpression expr) { final PsiElement formatArg = PsiUtil.skipParenthesizedExprDown(expr); if (formatArg == null) return; final @NonNls String newLineToken = "%n"; if (formatArg instanceof PsiLiteralExpression) { final PsiLiteralExpression replacement = joinWithNewlineToken((PsiLiteralExpression)formatArg); formatArg.replace(replacement); } else if (formatArg instanceof PsiPolyadicExpression){ final PsiElement lastChild = PsiUtil.skipParenthesizedExprDown((PsiExpression)formatArg.getLastChild()); if (lastChild instanceof PsiLiteralExpression) { final PsiLiteralExpression replacement = joinWithNewlineToken((PsiLiteralExpression)lastChild); lastChild.replace(replacement); } else { final CommentTracker ct = new CommentTracker(); final String text = String.format("%s + \"%s\"", ct.text(formatArg), newLineToken); ct.replaceAndRestoreComments(formatArg, text); } } else { final CommentTracker ct = new CommentTracker(); final String text = String.format("(%s) + \"%s\"", ct.text(formatArg), newLineToken); ct.replaceAndRestoreComments(formatArg, text); } }