Android Studio: line wrapping string literals

时间:2017-01-03 10:22:09

标签: android-studio wrapping string-literals

Android Studio supports a variety of wrapping options in its Code Style preferences... But I seem to be unable to find a way to have Android Studio wrap string literals which exceed the specified maximum line length.

All my other wrapping works fine, but something like this..

                                                   |
Log.l("SOMETAG", "Some rather long log message which exceeds the line length.");
                                                   |

.. will be wrapped like this, whith the literal still exceeding the line length max (here marked by |).

                                                   |
Log.l("SOMETAG",
    "Some rather long log message which exceeds the line length.");
                                                   |

What I would expect is something like this:

                                                   |
Log.l("SOMETAG", "Some rather long log message " +
    "which exceeds the line length.");
                                                   |

Anyone know of a way to achieve string wrapping as described??

Note: To the best of my knowledge all string literals concatenated using the + operand will be merged into single constant values by the Java compiler anyway, so although on the first glance it seems like there might be a difference in terms of the executed code there isn't one.

1 个答案:

答案 0 :(得分:0)

转到 文件 &gt;&gt;的 设置 &GT;&GT;的 编辑 &GT;&GT;的 爪哇 < /强>&GT;&GT;检查 确保未超出右边距 框右侧&gt;&gt;