On 2015-01-18 14:07, Allan Odgaard wrote:
The problem is that you only have a subset of the file in a diff and TextMate’s grammars will often work on larger structures.
Take the JSON grammar where we highlight misplaced commas, such rules can’t work when we just get a random line of a JSON file.
I tried to add the Diff rules in the D grammar, it wasn't perfect but ok. But it was not a general solution.
How would that be any difference if that's only what a user has typed in a regular JSON file?
For languages with keywords only typing a keyword is necessary to get highlighting. I think that would help.
For proper diff highlighting, we need to highlight the two source files separately, then grab the highlighted subsets for the diff.
Anyway, Github recently added this feature. I don't know how they did it but to me it looks good.