google / google/google-java-format

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

Open
#1,033 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
6.2k
Forks
937
Avg merge
6m
Merged PRs (30d)
3

Description

#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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.