Because it’s optimised for producing the smallest diff once it’s already been formatted and a change is made.
If you add a single item to your preferred style, the entire thing has to be reflowed.
If you add a single item to your preferred style, the entire thing has to be reflowed.
Even in a case where I need to add an item in the middle, the diff will - again - only start where I actually added an item, and any human can readily see that the rest of the downstream diffs were from the reflow.
Of course, it'd be even better if diff tools were more aware of the format/language of the code being diff'd, at which point it'd be able to say "new element added to foo" instead of reporting on a bunch of reflowed lines.
months = ["January", "February", "March", ...]
A human can make a smart decision, an autoformatter can't.A good diff will tell you:
foo = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ]
vs. >> foo = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ]
Better ones will underline the offending characters.For strings, it will format it like he formatted the array, and adding a word will reflow the entire block of text.