Monday, March 02, 2009

"Syntax highlighting" for diff

I just saw a reference to Sentdiff -- take a diff by sentence, not just by line -- over on Hacker News. I'd like to see a diff program that allows you to customise how it shows changes. Is there anything like this?

What are alternative ways to show changes? Consider Word's track changes feature, for example:

The best way to show changes, including what you want to consider as the 'units' that are being changed -- sentences, lines, etc -- really depends upon what the information in the document represents.

Perhaps you might want to show changes to a datafile with tabular or CSV structure differently to a file containing C code, for example. Or perhaps you might want to handle two different tabular-data files differently, because the types of entities they are describing are different - you parse them differently when you read them, or you think of them in some sort of different way... I feel pretty sure there's examples out there.

Think of it as like how text editors allow you to specify different syntax highlighting schemes, that colour different aspects of the documents in different ways, reflecting what the information in the document represents.

For that matter, it'd be good if a diff program could highlight syntax in exactly the same fashion as a text editor does - so if you're viewing a diff of a Java program, the document fragments it shows are shown with Java syntax highlighting.

No comments:

Post a Comment