You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make class extends and implements prettier by fitting to line width #13
public class ExtendsAbstractClassAndImplementsInterfaces extends AbstractClass implements Interface1, Interface2 {
It's just a line right now, when doesn't fit line, it should look like this? (open for discussion @azz)
public class ExtendsAbstractClassAndImplementsInterfaces indent extends AbstractClass indent implements Interface1, same pos as Inter1 Interface2
{`
(formatting code in an issue is hard?!)
From my experience its pretty common to have a class that extends and has at least 2 interfaces to implement. Actually that what you should love about java :)
I will work on this one on the next weekend and show you the output. Maybe I can convince you :)
Thanks for your feedback, I really appreciate this fast feedback!
Activity
j-f1 commentedon Jan 8, 2018
You could check out how it’s implemented in TypeScript for inspiration.
tvonhacht commentedon Jan 8, 2018
its just the same as i have, but is that really cool and readable?
j-f1 commentedon Jan 8, 2018
It might not be, but since people probably shouldn’t be writing code that’s that long, they should be willing to accept the result.
tvonhacht commentedon Jan 8, 2018
From my experience its pretty common to have a class that extends and has at least 2 interfaces to implement. Actually that what you should love about java :)
I will work on this one on the next weekend and show you the output. Maybe I can convince you :)
Thanks for your feedback, I really appreciate this fast feedback!
j-f1 commentedon Jan 8, 2018
I was just going by my TS knowledge (I don’t know Java, I’m just attempting to help based on what I know of other languages).
tvonhacht commentedon Jan 8, 2018
I'm very grateful for your feedback, I hope I didn't come off wrong.
tvonhacht commentedon Jan 9, 2018
@j-f1 Please check this :)
https://github.com/thorbenvh8/prettier-java/blob/master/PREVIEW.md#extends_abstract_class_and_implements_interfaces
I find it really pretty and would really appreciate this in my projects like this :)
j-f1 commentedon Jan 9, 2018
That looks really nice! If you have time, would you be willing to contribute that style to the JS printer? The current style is not as nice.
tvonhacht commentedon Jan 9, 2018
@j-f1 It would be an honor for me :)
you mean prettier/prettier project?
j-f1 commentedon Jan 9, 2018
Yes, that’s the one.
tvonhacht commentedon Jan 9, 2018
@j-f1 I implemented it here in my own fork branch :)
https://github.com/thorbenvh8/prettier/tree/extends_implements
can you please check? I actually changed 148 snapshots...
tvonhacht commentedon Jan 9, 2018
I made it so it always adds a hardline before extends and implements no matter how long the line
j-f1 commentedon Jan 9, 2018
That doesn’t look as nice IMO — it should only break if needed, especially since implementing multiple interfaces isn’t as common in JS-land.
azz commentedon Jan 9, 2018
Yeah we definitely want to keep the "if it fits, print it" approach.
tvonhacht commentedon Jan 9, 2018
Ok fixed it :) sorry for the missunderstanding :) Will do this in java too, youre right it makes sense :)

This is the output now :)
@j-f1 @azz Im gonna create a pull request from this?
j-f1 commentedon Jan 9, 2018
Looks awesome!
azz commentedon Jan 9, 2018
Great stuff! Absolutely open a PR :)
tvonhacht commentedon Jan 9, 2018
https://github.com/prettier/prettier/compare/master...thorbenvh8:extends_implements?expand=1#diff-39d2f7757817713deaa0ad8b7c23ee3f
I have to fix some tests that are now not working as they were intended :) then I will create a PR :)
tvonhacht commentedon Jan 9, 2018
Side question why does the ci pipeline in travis takes 52 mins?