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
The maven plugin seems not to support JSON formatting. Is there a good reason for this? Or would it be considered a good contribution from a new-comer ?
A PR is open. I see this will not fulfil my own need ('\t' as tabulation). Ecryd sortPom accepts -1 spaces to trigger tabulation indentation (https://github.com/Ekryd/sortpom/wiki/Parameters#for-both-the-sort-and-verify-goal). Is it OK I open another PR to accept such a parameter in com.diffplug.spotless.json.gson.GsonStep.State.generateIndent(int)?
If the only problem is indenting with tabs vs space, I would recommend the indentWithTabs step instead of adding a feature/mode to an existing step. If it's a small amount of new code I'd be okay to merge another PR, but if it's a lot of code I'd rather point people to indentWithTabs.
Thanks @nedtwigg. The existing PR does not hold anything relating to tabs.
Being new to Spotless, it took few a few seconds to understand your point. My suggested changes (-1 for tabulation) would be very minimal. I agree it is awkward, still it is the way some plugin works (e.g. Ecryd SortPom, then some formatting-plugins users are used to it (at the very least myself,, which is of course veryopinionated xD)).
I see the gradlePlugin enables Prettier and other external formatters to enable JSON formatting. However, it seems more difficult to reach with maven. Could you provide a snippet of the mvn pom.xml <configuration /> section how you would recommend reaching tabs in json formatting? (If it is an existing feature, I could open a dedicated ticket, else it would help me understand how to best implement this feature.)
doesn't break and has tests so it stays not broken
won't be hard for the Spotless team to maintain into the future
So whatever -1 flags you want to add are okay with me, but I still think this existing feature is easier to use and definitely easier to build (already done!)
@nedtwigg I now better understand your point. Something unclear to me was how <formats> and <json> would interleave themselves. I suppose formats are applied after specialized formatters (as mvn is much less expressive in term of ordering/customization than gradle), in which case tab indentation is already feasible.
The PR for JSON formatting in mvn is ready.
I open another issue which may describe an issue related to interleaving formats and specialized formatters (#1455)
Activity
nedtwigg commentedon Jan 3, 2023
There is no reason for it, and it would be a great contribution from a newcomer!
blacelle commentedon Jan 3, 2023
A PR is open. I see this will not fulfil my own need ('\t' as tabulation). Ecryd sortPom accepts -1 spaces to trigger tabulation indentation (https://github.com/Ekryd/sortpom/wiki/Parameters#for-both-the-sort-and-verify-goal). Is it OK I open another PR to accept such a parameter in com.diffplug.spotless.json.gson.GsonStep.State.generateIndent(int)?
nedtwigg commentedon Jan 3, 2023
Thanks for the PR
If the only problem is indenting with tabs vs space, I would recommend the
indentWithTabsstep instead of adding a feature/mode to an existing step. If it's a small amount of new code I'd be okay to merge another PR, but if it's a lot of code I'd rather point people toindentWithTabs.blacelle commentedon Jan 4, 2023
Thanks @nedtwigg. The existing PR does not hold anything relating to tabs.
Being new to Spotless, it took few a few seconds to understand your point. My suggested changes (-1 for tabulation) would be very minimal. I agree it is awkward, still it is the way some plugin works (e.g. Ecryd SortPom, then some formatting-plugins users are used to it (at the very least myself,, which is of course veryopinionated xD)).
I see the gradlePlugin enables Prettier and other external formatters to enable JSON formatting. However, it seems more difficult to reach with maven. Could you provide a snippet of the mvn pom.xml
<configuration />section how you would recommend reaching tabs in json formatting? (If it is an existing feature, I could open a dedicated ticket, else it would help me understand how to best implement this feature.)nedtwigg commentedon Jan 4, 2023
I am terrible at maven, I just merge things that
So whatever -1 flags you want to add are okay with me, but I still think this existing feature is easier to use and definitely easier to build (already done!)
blacelle commentedon Jan 5, 2023
@nedtwigg I now better understand your point. Something unclear to me was how
<formats>and<json>would interleave themselves. I suppose formats are applied after specialized formatters (as mvn is much less expressive in term of ordering/customization than gradle), in which case tab indentation is already feasible.The PR for JSON formatting in mvn is ready.
I open another issue which may describe an issue related to interleaving formats and specialized formatters (#1455)
nedtwigg commentedon Jan 14, 2023
Published in
plugin-maven 2.30.0, thanks for the great PR @blacelle.