google / google/google-java-format

String Templates Formatting for """ Multi-Line is "not nice"

未关闭
#1,033 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
6.2k
派生
937
平均合并
6 分钟
30 天内合并 PR
3

描述

#981 introduced [JEP-430](https://openjdk.org/jeps/430) / [JEP-459](https://openjdk.org/jeps/459) _String Templates_ support.

This works great (~leaves it alone) for "single line", e.g. `var html = STR."";`

However [when exploring using this](https://github.com/enola-dev/enola/blob/719a747f1d89c6bc362e6282f986c364b56e5a7a/web/ui/src/main/java/dev/enola/web/ui/ThingUI.java#L37) for `"""` Multi-Line it currently formats like this:

```java
return STR."""

""";
```

To my eyes, that line break (as if it was a Builder type thing, presumably?) looks fairly "ugly"; I would expect it to simply look like this instead:

```java
return STR."""

""";
```

Do folks agree?

@cushon

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。