7 ms·
I suppose that these days I am one of the few professional programmers who has an active dislike of syntax highlighting. I find it immensely distracting. The on
by kieckerjan 5y ago
I suppose that these days I am one of the few professional programmers who has an active dislike of syntax highlighting. I find it immensely distracting. The only stuff I allow the highlighter to touch are my comments (I turn them bold) and I consider this a somewhat frivolous indulgence.
(I appreciate the complexity of the problem, btw)
- Derbasti 5y agoA few years ago I switched my color theme to something very simple, just as an experiment. Somehow I never found a need to change that. I highlight comments, keywords, and strings. Comment and string highlights are helpful if they contain code-like text, to make them obviously not-code. Keywords give some structure to the text. Everything else is frivolous to me. Books do not highlight verbs in green, either.
- xyzzy_plugh 5y ago> Books do not highlight verbs in green, either. While I will not argue with your general point -- I also don't really need highlighting and I read a lot of plaintext code -- I wonder about this. Would this make languages easier for non-native speakers? Would improve comprehension? It's funny that the industry spends so much time on syntax highlighting for programming languages, when humanity's written languages are arguably more complex and difficult to parse and master.
- Derbasti 5y agoI think the point is that books do highlight things: Headlines, italics, Capitalization. Just not silly technicalities like parts of speech.
- unhammer 5y ago> Would this make languages easier for non-native speakers? Would improve comprehension? When I've been trying to learn languages, I can typically part-of-speech tag unknown words quite easily (common prefixes/suffixes/word length/sentence position give lots of information – and some of this is shared across languages as well). The comprehension difficulty is nearly always due to content words I haven't seen before (or have forgotten).
- yewenjie 5y agohow do you know when you have missed one single parenthesis somewhere ?
- kieckerjan 5y agoDoes it sound presumptuous if I say that hardly ever happens? And if it does, the compiler never fails to remind me. :-)
- petepete 5y agoThere's no correct answer here, it's totally subjective. I can sympathise with both sides; I like syntax highlighting when it's done well - when it's distracting I turn it off. Seeing a keyword highlighted within a comment is an instant red flag - unfortunately it happens loads in Azure Data Studio (which I need to occasionally use). Never happened in TreeSitter though.
- shirleyquirk 5y agoparentheses matching is a surprisingly non-trivial problem. (i.e. simple counting of opening and closing parens isn't sufficient, given that quoted parens shouldn't be counted) For humans, ignoring quoted parens is maybe easier, but i would say it's a flex to assert that you can tell if (3,(g(f('('),x))) is balanced at a glance. even if you can, surely you're wasting time and/or focus on an automatable task. But we all have something we do 'the hard way' because it feels like more effort to relearn the task than its worth, or because we tried the easy way once and were put off by some side-effect. paren highlighting never comes as a single unit, its always packaged with other 'helpful' tools, some subset of which will always be infuriating to someone.
- kieckerjan 5y ago> For humans, ignoring quoted parens is maybe easier, but i would say it's a flex to assert that you can tell if (3,(g(f('('),x))) is balanced at a glance. True, but mentally balancing parentheses is usually something that you do while writing the code: you pushpop a little stack in your head and this becomes second nature. Mentally verifying if parentheses are balanced while reading code is hardly ever required. You can usually safely assume that they are (unless that darn compiler tells you otherwise).
- orf 5y agoI guess it turns out actively depriving yourself of relevant information at a glance isn’t that popular, no.
- kieckerjan 5y agoThe way I see it, most syntax highlighting is actively adding mostly irrelevant information to the cognitive load of programming: stuff that should be obvious if you know the language. It does as little for my understanding as a novel in which, say, every proper noun was printed in red. I can imagine more useful highlighting than color coding the types of the symbols encountered. Lighting up the active scopes. Giving the same hue to names that look like each other. There are probably highlighters out there that do that. But "simple" syntax highlighting is still the norm.
- orf 5y agoThe same argument could be made for seeing anything in colour: > most colours are actively adding irrelevant information to the cognitive load of existing. It should be obvious that apples and red and the sky is blue. That’s silly, because it does add relevant information. Obviously it’s a spectrum - too many colours can hide information, but when used appropriately it’s fine. Also everyone is different. Perhaps your brain gets distracted by the colours more than the majority of people.
- mijoharas 5y ago> Lighting up the active scopes As you had guessed a little later, there are a few different emacs packages that do this. One of them is "rainbow parentheses" that gives every bracket a different colour (remember that emacs supports lisp, so differentiating between lots of different parentheses is arguably more useful in emacs than any other editor). [0]. Another one is highlight parentheses [1] which highlights all parens that enclose the cursor position, and gives a darker colour to those "further away" from the cursor. [0] https://github.com/Fanael/rainbow-delimiters https://github.com/Fanael/rainbow-delimiters [1] https://sr.ht/~tsdh/highlight-parentheses.el/ https://sr.ht/~tsdh/highlight-parentheses.el/
- ReleaseCandidat 5y ago
- harrisfarris 5y agoI feel the same way. Never understood what the point of highlighting certain keywords or if something is a type or a function would be, it's all obvious from the grammar and where things are positioned anyway. And When I read code I want to read all of it, not draw any particular attention to "if" or "else".
- deleted 5y ago[deleted]
- robert-brown 5y agoKeyword highlighting is explicitly called out as an antipattern in the book Human Factors and Typography for More Readable Programs, which I highly recommend.
- AkshitGarg 5y agoWhile I don't fully disable syntax highlighting, I use a minimal theme [0,1] that only has highlighting for comments, strings and globals. It reduces eye strain for me, and I never find myself relying on highlighting to navigate through code. LSPs provide an "outline" which can be very useful to navigate through code. I find "jump to symbol" function in my text editor to be faster than scanning all of the code to find the line. Also most themes dim the comments, but IMO if something in the code needed an explanation, it should be brighter, not dimmer. [0]: https://github.com/tonsky/sublime-scheme-alabaster https://github.com/tonsky/sublime-scheme-alabaster [1]: https://github.com/gargakshit/vscode-theme-alabaster-dark https://github.com/gargakshit/vscode-theme-alabaster-dark
- llimllib 5y ago> Also most themes dim the comments, but IMO if something in the code needed an explanation, it should be brighter, not dimmer. That makes me crazy! I use base2tone, which is not nearly as minimal as your theme but more than most, and I modify the comments to be bright.
- brabel 5y agoI would normally respond that, as others have pointed out, you're basically saying you prefer to "hide" information that, to most people, is relevant (is this a keyword, a global or local variable, a type, a method, a static function...), but I've noticed that when I'm doing code review, using the shitty BitBucket interface which shows everything red or green, without any code highlighting, actually helps me a little bit to focus on the changeset as opposed to what the code is actually doing in general. This is helpful because the changeset is what I care about when doing a review (what's different than before is the first question, with understanding what code is actually doing comes second)... Later, I might need to look at the code in my IDE with proper highlighting to better understand what the changed code is actually doing in more detail, but that's rarely needed (unless it's comprehensive changes). So, it occurred to me that whether syntax highlighting is actually useful depends somewhat on the context, what are you trying to do?! I suppose it's easy to extend that realization to people who are different and might feel overloaded by information more easily, so I can sympathize with what you're saying (hope this doesn't sound condescending, I am just trying to say people can have very different cognition overload levels, regardless of how capable they actually are in general).
- chriswarbo 5y agoSyntax highlighting is pretty redundant. Some interesting alternative uses of colour information are given at https://buttondown.email/hillelwayne/archive/syntax-highlighting-is-a-waste-of-an-information https://buttondown.email/hillelwayne/archive/syntax-highligh... (e.g. colouring different scopes, or different imports) I also like the idea of using colour to distinguish different identifiers, e.g. https://wordsandbuttons.online/lexical_differential_highlighting_instead_of_syntax_highlighting.html https://wordsandbuttons.online/lexical_differential_highligh... https://medium.com/@evnbr/coding-in-color-3a6db2743a1e https://medium.com/@evnbr/coding-in-color-3a6db2743a1e 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...
- NoGravitas 5y agoNot to bikeshed on this, but I have a pretty strong preference for minimalist syntax highlighting. I'm currently using tao-themes in emacs: matching light and dark themes that are grayscale or sepiatoned, and mostly use character properties like bold or italic along with a few shades of gray. Much more calming than the usual "angry fruit salad on black" programmer themes, but also providing more intuitive information than no syntax highlighting.
- jpe90 5y agoThanks for the recommendation! I've been on the lookout for a good monochrome theme, this looks great to me w/ boxes off
- catskul2 5y agoTo each their own, and fortunately most(all?) editors allow such features to be turned off. On the other hand, I find the "frivolous indulgence" perspective extremely obnoxious along with the related implication of moral or technical superiority of not using syntax highlighting. As a side note, the way it helps many people who prefer it has some fascinating cog-psych underpinnings: https://en.wikipedia.org/wiki/Visual_search https://en.wikipedia.org/wiki/Visual_search Sometimes I wonder if those who don't prefer it might have some synesthesia which might allow their brain hardware to provide what the syntax highlighting does for the rest of us.
- IshKebab 5y agoYes it's pure egotism. "I don't need silly colours to code, not like those noobs." You get the same attitude a lot for things like autocomplete and even for static typing.
- robert-brown 5y agoAnyone interested in syntax highlighting should read the book Human Factors and Typography for More Readable Programs. The majority of the book is devoted to non-color techniques, but they do present some ideas for how to effectively use color near the end. Much of syntax highlighting in the wild is junk, just distracting eye candy.