[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntactic fontification of diff hunks

From: Yuri Khan
Subject: Re: Syntactic fontification of diff hunks
Date: Sat, 18 Aug 2018 01:34:04 +0700

On Sat, Aug 18, 2018 at 12:50 AM Juri Linkov <address@hidden> wrote:

> I think “after” should have priority over “before” in context because the
> main goal of reading patches is to see how code will look after changes,
> so in this case ‘(bar baz)’ should be highlighted as a string.

Yes, that is sensible.

I see another potential issue. In your patch above, the whole hunk is
fontified as a whole, with all its context lines, deleted lines, and
added lines. A change on the line that opens a multiline string will
disrupt syntax until the end of hunk:

     (def foo ()
    -  "Lorem ipsum
    +  "Cthulhu fhtagn
       dolor sit amet")

A more robust approach would be to fontify separately the “after”
version by taking context + added lines and “before” by taking context
+ deleted lines. Then use fontification from “before” for deleted
lines, and from “after” for context and added lines.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]