-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String Templates Formatting for """ Multi-Line is "not nice" #1033
Comments
Agreed. The extra line-break happens with |
I agree this is not ideal. I think the specific change in |
Or does it? I just ran into the following, and am surprised I didn't run into this previously (it's likely because I reinstalled tools from scratch, so it's possible my $ git clone https://github.com/enola-dev/enola.git
$ git checkout 983f7ee
$ ./test.sh
$ source .venv/bin/activate [.fish, or not; depending on your shell]
$ pre-commit run --all-files
Google Java Formatter....................................................Failed
- hook id: pretty-format-java
- exit code: 1
[cwd=/home/vorburger/git/github.com/vorburger/enola] Run command: ('java', '-version')
[return_code=0] |
stderr: openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+9-Debian-2)
OpenJDK 64-Bit Server VM (build 17.0.9+9-Debian-2, mixed mode, sharing)
Downloading https://github.com/google/google-java-format/releases/download/v1.19.2/google-java-format-1.19.2-all-deps.jar
[cwd=/home/vorburger/git/github.com/vorburger/enola] Run command: ('java', '--add-exports', 'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED', '--add-exports', 'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', '--add-exports', 'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED', '--add-exports', 'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED', '--add-exports', 'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED', '-jar', '/home/vorburger/.cache/pre-commit/google-java-formatter1.19.2.jar', '--set-exit-if-changed', '--aosp', '--replace',
(...)
[return_code=1] |
stderr: tools/hello/src/main/java/dev/enola/common/hello/Hello.java:30:30: error: illegal escape character
tools/hello/src/main/java/dev/enola/common/hello/Library.java:27:30: error: illegal escape character
web/ui/src/main/java/dev/enola/web/ui/ThingUI.java:72:50: error: illegal escape character
web/ui/src/main/java/dev/enola/web/ui/ThingUI.java:73:34: error: illegal escape character |
@vorburger the |
#981 introduced JEP-430 / JEP-459 String Templates support.
This works great (~leaves it alone) for "single line", e.g.
var html = STR."<table class=\"\{cssClass}\">";
However when exploring using this for
"""
Multi-Line it currently formats like this: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:
Do folks agree?
@cushon
The text was updated successfully, but these errors were encountered: