4 ms·
I don't buy it. 1. I personally find syntax highlighting incredibly helpful as a way of setting off syntactic elements, and incidentally as a way of calling at
by duskwuff 6y ago
I don't buy it.
1. I personally find syntax highlighting incredibly helpful as a way of setting off syntactic elements, and incidentally as a way of calling attention to typos (like a missing quote or misspelled keyword). The author seems to dismiss this without any analysis.
2. Using color for syntax highlighting doesn't mean you can't also use color to highlight other useful things (like search results or errors), as the author suggests. Many editors which support syntax highlighting do exactly this!
3. The author's examples aren't particularly compelling. For example, using colors to denote levels of nesting will make code flash between colors as you edit it. Highlighting variables by type feels like a form of syntax highlighting, not something new, and most of the examples of highlighting code which meets specific conditions (variables which are assigned to multiple times, long functions, functions without documentation, etc) all feel like they could be summarized as "linter warnings/failures".
- em-bee 6y agousing colors to denote levels of nesting will make code flash between colors as you edit it. why would that be a problem? the nesting wouldn't change with every keystroke, but only as you type the specific characters that define the nesting. and depending on your editor or your typing habit you may type opening and closing characters first before filling in the content, thus you wouldn't break the nesting structure either. the pharo smalltalk code editor highlights nesting brackets and parentheses in different colors, and i don't see any flashing of colors.
- mercer 6y agoI think it's important to separate the various suggestions the author offers from the actual implementation. Currently, when my cursor is over a bracket, the matching one is already highlighted. I'd love it when in this situation his suggestion to color the brackets would 'activate'. Or when my cursor (or mouse) is on a variable, I'd like to see the highlighting by type. I can also imagine having a 'highlighting' bar somewhere on screen where I can switch between different forms of highlighting. When I'm doing a code review, highlight based on interesting conditions (long functions, lack of documentations, etc.).
- RHSeeger 6y agoA lot of the things he mentions do exist in different places. For example, the parens https://www.emacswiki.org/emacs/RainbowDelimiters https://www.emacswiki.org/emacs/RainbowDelimiters
- stevehine 6y agoVS Code / Visual Studio both have a 'rainbow indent' extension which colours the indented space rather than the highlighted code. But it relies on the code being formatted correctly; rather than anything semantic in the language. It's still useful !
- SAI_Peregrinus 6y agoAnd the numerous rainbow bracket extensions for various editors, which color brackets and parentheses differently depending on nesting level.