jsinspect
jsinspect copied to clipboard
Highlight diffs in duplicated code
Would be nice to highlight the identifiers/literals that are the only difference between the snippets, when one uses the -I
or -L
options, in a similar manner to a color diff.
They would be helpful in refactoring since I'd have an hint on what should be a parameter of the newly created function.
Have you thought about it?
We previously outputted diffs:
However, they didn't work very well when they were n-way diffs, such that N was more than 2 instances in a match. The output was quite confusing and difficult to parse.
Yeah, I actually realized this and modified the text :)
The new idea would be just a highlight on the literal/identifier that is not in common between the multiple chunks. Would that be better?
We previously outputted diffs:
The link is broken for me
However, they didn't work very well when they were n-way diffs, such that N was more than 2 instances in a match. The output was quite confusing and difficult to parse.
But for N=2 such a diff would be extremely useful, it can work the way it works now by default, yet resort to display diffs for N=2 if an explicit command line argument is used?
Now I have to pipe the output into vim, copy/paste the chunks by hand into temporary files and run vimdiff on them, because I don't know of a better way.