facebookarchive / codemod

Codemod is a tool/library to assist you with large-scale codebase refactors that can be partially automated but still require human oversight and occasional intervention. Codemod was developed at Facebook and released as open source.
Apache License 2.0
4.11k stars 198 forks source link

Show a smarter diff #95

Open benjaminjkraft opened 7 years ago

benjaminjkraft commented 7 years ago

This mostly only applies to usage as a library, although in principle one could hit it with a large multiline regexp. It would be really nice if instead of just showing the entire removed block as red and the entire added block as green, codemod could show a more concise diff. This would be especially useful for codemods that reorder lines, for example by moving a line up a few lines -- right now they show a big unreadable block of red and green, but they could just show a single red and a single green line.

(In an ideal world, they could even allow diff-splitting, like git add -p, but I don't think that's particularly compatible with the current Patch architecture.)