View Full Version : Syntax highlight vs differences highlight
Hello!
Grammar and syntax highlight are very nice features, yet they cause sometimes some interesting effects.
1. Usually you can see exact differences in similar lines:
set @a = 1
vs
set @b = 1
But if you set "Show syntax highlight on difference lines" switch on (Tweaks -> Text Views), this color information is lost, even though neither syntax element uses red.
Of course, you can use background highlight for these differences (Options -> File Views -> Compare Colors -> Difference Enhancer ruler), but it creates very messy and overloaded view on files with many small differences.
Michael Bulgrien
23-Jun-2009, 12:09 PM
if you set "Show syntax highlight on difference lines" switch on (Tweaks -> Text Views), this color information is lost, even though neither syntax element uses red.
Of course, you can use background highlight for these differences (Options -> File Views -> Compare Colors -> Difference Enhancer ruler), but it creates very messy and overloaded view on files with many small differences.
That is why "Show syntax highlight on difference lines" is a tweak, and not standard functionality.
However, there is an option that you should be able to do. Unfortunately, there is a bug in BC3 that prevents it from working. Hopefully the Scooter team will fix it as a result of this thread.
What should work: You can toggle syntax highlighting from the View menu. You can add the option to your toolbar to make it easily accessible. Disabling syntax highlighting should allow you to view the changes in the line temporarily, then you can re-enable syntax highlighting when you're done.
Why it doesn't work (BC3 bug): If you set "Show syntax highlight on difference lines" then difference lines will remain highlighted even when you toggle syntax highlighting from the View menu. In other words, highlighting disappears in the entire file except for on difference lines. This is a bug. The tweak should follow the Syntax Highlighting toggle on the View menu.
Original message was truncated for some reason. Trying to re-post.
2. Different grammar elements are always deemed totally different even though they are very similar.
For example, in SQL syntax you have identifiers (table names, field names, etc) and variables (they start with "@" prefix). Changes from identifiers to variables and back are common:
select * from @TableName
vs
select
Aaron
30-Jun-2009, 02:58 PM
Thanks Michael.
I've reproduced the behavior you are seeing, and I've created a tracker entry for this issue.
Aaron
30-Jun-2009, 03:02 PM
Hello,
Was your second line "select" also truncated? It is possible you are typing in code that vBulletin is interpreting as formatting code. Use the Code tool to help if this is an issue.
Different Grammar elements are marked as differences even if the text is similar. This is by design. So the statement
"This is a string"
and
This is a string
will be marked as a difference since the later text is not a string grammar element.
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.