TJ-Bot
TJ-Bot copied to clipboard
Update eclipse jdt formatter configuration
We should update our formatting configuration. It's based on old google style, and it lacks all the new features.
It also has a weird issue with formatting a specific record. Issue noticed first here: https://github.com/Together-Java/TJ-Bot/pull/140. Investigated by spotless devs here: https://github.com/diffplug/spotless/issues/951
After investigation, the conclusion is that our configuration is the issue. And our band-aid solution was to pin the eclipse jdt formatter version to the latest known working, eclipse('4.19.0')
.
Partly because of that pinning, we don't have @snippet
support. https://github.com/Together-Java/TJ-Bot/issues/591. And we will continue experiencing more and more issues down the line.
It's also a good opportunity to rethink our formatter choice, use better and smarter configuration etc.
This issue is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.
i'd like to work on this. Should the configuration should be same as before?
Yeah, ideally it would be the same, or almost the same. It's not a hard requirement tho, we could agree on a different style, in case it's superior for whatever reason.
The best way we found to edit and test the configuration is in eclipse preferences, formatter edit tool. You can export or import configurations, and edit them in real time with a preview.
Looks like this: editing eclipse formatter
Since this issue hasn't been updated, and I was on the vacation, I'm not up-to-date on the recent developments. Tell me if I can help you with anything. :relaxed:
Hey! I came across this issue on the spotless repo https://github.com/diffplug/spotless/issues/951 because i was having the same issue. I noticed it wasn't resolved in your repo so i opened a PR for it. https://github.com/Together-Java/TJ-Bot/pull/1105
Basically, the issue revolves around the source version being set to 1.7 <setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/>
. I noticed you're on 21 so i bumped all 3 compiler settings to 21
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="21"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="21"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="21"/>
and reran spotless ./gradlew spotlessApply
There may be some undesirable changes after removing the pinned eclipse jdt version, so you may want to check the files affected.