Skip to content
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

Make a delombok pretty mode #643

Closed
lombokissues opened this issue Jul 14, 2015 · 13 comments
Closed

Make a delombok pretty mode #643

lombokissues opened this issue Jul 14, 2015 · 13 comments

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 608)

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Nov 20, 2013 at 01:09 UTC

Delombok currently generates code that's great to be processed by other tooling, but not so good for either migrating from lombok or rendering on a website.

Some issues are already logged to make this better, others can be added to this issue:

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Nov 20, 2013 at 01:31 UTC

Other things to be fixed in the pretty printer, regardless of any switch:

  • In try-with-resources in the list of resources, improve the rendering of multiple declarations, suppress "final" and the trailing semicolon.
  • After case-statements, if it is followed by a block, render the opening brace on the same line
  • Improve the rendering of labeled statements
  • Don't render an empty line for the suppressed "super();" statement in constructors

@lombokissues
Copy link
Author

👤 reinierz   🕗 Nov 20, 2013 at 19:28 UTC

Done so far (branch: pretty-delombok):

  • Try-with-resources cleaned up.
  • labelled statements cleanup
  • super(); empty line suppression.
  • infrastructure for conveying (via delombok commandline) and referencing format parameters.
  • auto-detect and application of indent-or-blank empty lines behaviour.
  • auto-detect and application of indent string (tabs, 4 spaces, etc) behaviour.

@lombokissues
Copy link
Author

👤 reinierz   🕗 Nov 21, 2013 at 02:05 UTC

Tricky addition: Can we do some voodoo magic and truly copy-and-paste as many things that are in the original source file as possible? Presumably any node in the tree for which the rule holds nor it, nor any of its children (recursive) are generated or modified, can be copy-pasted straight from the source by using the start/end markers. I'm not sure how reliable the start/end markers are (they mostly aren't, IIRC, only lombok.ast offers start/end positions that are all-inclusive), so this might not be feasible, but would be a nice addition to have delombok's impact reduced to an absolute minimum.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Dec 11, 2013 at 20:16 UTC

Issue #640 has been merged into this issue.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Dec 11, 2013 at 20:31 UTC

Issue #639 has been merged into this issue.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Dec 11, 2013 at 20:32 UTC

Issue #638 has been merged into this issue.

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Dec 11, 2013 at 20:32 UTC

Issue #214 has been merged into this issue.

@lombokissues
Copy link
Author

👤 reinierz   🕗 Dec 11, 2013 at 21:47 UTC

... and it's live! At least in edge:

https://projectlombok.org/download-edge.html

give it a spin!

@lombokissues
Copy link
Author

👤 reinierz   🕗 Jan 15, 2014 at 21:27 UTC

This fix is now part of the latest official release. 1.12.4 was just pushed for download and to maven central.

@lombokissues
Copy link
Author

👤 cbeams   🕗 Mar 23, 2014 at 17:41 UTC

I've just tried 1.12.4 out, and it's looking really nice. The auto-detection of spaces v. tabs is working as expected, and I now get clean diffs. Thank you!

I'm still seeing lots of @ SuppressWarnings and @ ConstructorParameters, however. Are this indeed able to be shut off now?

@lombokissues
Copy link
Author

👤 r.spilker   🕗 Mar 26, 2014 at 19:23 UTC

You can turn these off via the prettyprint settings.

run:

java -jar lombok.jar delombok --format-help

for more info. I think you're looking for:

java -jar lombok.jar delombok -f pretty -f constructorProperties:skip

There's a mention of --format-help on the delombok page, which may contain a few other relevant sections. That page is here:

https://projectlombok.org/features/delombok.html

@lombokissues
Copy link
Author

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant