4 ms·
There was a good point made, that has stuck with me over the years. that our syntax highlighters are highlighting the wrong thing. They should not be coloring
by somat 2y ago
There was a good point made, that has stuck with me over the years. that our syntax highlighters are highlighting the wrong thing.
They should not be coloring the grammar, we are good at picking out grammar, they should be highlighting the symbols. each different variable and function name should be getting it's own color. that is, the goal is to make it quicker to distinguish different symbols, not that they are a symbol.
But this is much harder than stylizing the grammar so all our tooling sticks with the easy thing rather that the useful thing. Now, I am being a bit mean on grammar styling. It does help quite a bit but I would like to see a symbol matching engine in action to see if that really works.
Unfortunately I don't remember where I read the original post and am unable to attribute it correctly.
update: while trying to look it up I found this https://www.wilfred.me.uk/blog/2014/09/27/the-definitive-guide-to-syntax-highlighting/ https://www.wilfred.me.uk/blog/2014/09/27/the-definitive-gui...
- sicariusnoctis 2y agoThe author of that post wrote "difftastic", which is "a structural diff that understands syntax" using treesitter. https://difftastic.wilfred.me.uk/ https://difftastic.wilfred.me.uk/ https://github.com/Wilfred/difftastic https://github.com/Wilfred/difftastic
- aquariusDue 2y agoTotally agree, at first it looked alien to me but I've grown used to and prefer this way of highlighting. Personally I use color-identifiers-mode[0] for Emacs. [0] https://github.com/ankurdave/color-identifiers-mode https://github.com/ankurdave/color-identifiers-mode
- milliams 2y agoThis is what KDevelop called Semantic Highghting (as opposed to Syntax Highlighting). I think it was there earlier than this, but the earliest post I can find describing it is from 2009: https://zwabel.wordpress.com/2009/01/08/c-ide-evolution-from-syntax-highlighting-to-semantic-highlighting/ https://zwabel.wordpress.com/2009/01/08/c-ide-evolution-from...
- tjoff 2y agoWe are pretty good at picking out variable names too... Especially if the grammar itself is highlighted since we then know exactly where to look / where not to look. I'm not convinced of the argument, but still a bit curious. I sometimes highlight a variable to follow it and make sure I don't miss an instance of it, so that I totally get. But not sure we have enough colors and contrast to make sense to follow many variables without cluttering everything up. A compromise might be to manually color up to 3 or something variables. ... but the cases where that helps may be a sign that the code isn't very readable to begin with (helping with messy codebases is a proper usecase though!).