Live data from Hacker News

The Definitive Guide to Syntax Highlighting

wilfred.me.uk

1–10 of 24 posts

Re: The Definitive Guide to Syntax Highlighting

#2
Whenever syntax highlighing is being discussed, I like to plug Linus Åkesson's 'A Case Against Syntax Highlighting': http://www.linusakesson.net/programming/syntaxhighlighting/

Personally, I do find syntax highlighting to be useful, but I think it is an interesting dissenting opinion that is worth mentioning. OP's article mentions that Acme doesn't have syntax highlighting, but doesn't really expand on that.

Re: The Definitive Guide to Syntax Highlighting

#4
I've seen more than one talk where the presenter lamented a lack of highlighting based on highly nested structures. So, for example, changing the color based on the closure that one is in. Or, changing the color based on the execution context one is in (so one can make sure they are modifying the variable in the appropriate context).

This would be useful in langues that make heavy use of callbacks such as javascript or scala.

Not sure how hard it would be to implement though - it might require a full parse or compiler pass.

Re: The Definitive Guide to Syntax Highlighting

#5
post #2

Whenever syntax highlighing is being discussed, I like to plug Linus Åkesson's 'A Case Against Syntax Highlighting' : http://www.linusakesson.net/programming/syntaxhighlighting/ Personally, I do find syntax highlighting to be useful, but I think it is an interesting dissenting opinion that is worth mentioning. OP's article mentions that Acme doesn't have syntax highlighting, but doesn't really expand on that.

Better to ask Rob Pike why it doesn't.

Re: The Definitive Guide to Syntax Highlighting

#6
post #2

Whenever syntax highlighing is being discussed, I like to plug Linus Åkesson's 'A Case Against Syntax Highlighting' : http://www.linusakesson.net/programming/syntaxhighlighting/ Personally, I do find syntax highlighting to be useful, but I think it is an interesting dissenting opinion that is worth mentioning. OP's article mentions that Acme doesn't have syntax highlighting, but doesn't really expand on that.

Somehow I have never found that essay very convincing.

There is something to be said for clean language design and minimal, a non-distracting editing environment, of course. But the essay doesn't argue the case in any reasoned fashion. It mostly just makes emotional arguments (the talk about training wheels, the example with highlighting fiction, which is over the top).

I have worked with large codebases in plain vi and PFE [1] in my wayward youth. It wasn't exactly what I would call a pleasant experience.

[1] https://en.wikipedia.org/wiki/Programmer%27s_File_Editor

Re: The Definitive Guide to Syntax Highlighting

#7
post #5
post #2

Whenever syntax highlighing is being discussed, I like to plug Linus Åkesson's 'A Case Against Syntax Highlighting' : http://www.linusakesson.net/programming/syntaxhighlighting/ Personally, I do find syntax highlighting to be useful, but I think it is an interesting dissenting opinion that is worth mentioning. OP's article mentions that Acme doesn't have syntax highlighting, but doesn't really expand on that.

Better to ask Rob Pike why it doesn't.

From Acme Faq [1]: "No. The creator of main users of Acme find syntax highlighting unhelpful and distracting."

[1] http://acme.cat-v.org/faq

Re: The Definitive Guide to Syntax Highlighting

#8
post #3

Does this exist in Sublime Text too? ... color-identifiers-mode, rainbow-delimeters and highlight-parentheses-mode

I believe that Sublime Text is a descendant from Textmate, and therefore uses a single table of recursive regular expressions for syntax highlighting.

It therefore can not distinguish multiple instances of the same thing (different variables) or overlay different highlighting modes on top of one another.

Re: The Definitive Guide to Syntax Highlighting

#9
The article doesn't mention highlighting the declarations/definitions of types & variables. I find it far less obtrusive, and more useful, than lexical highlighting. It's surprisingly easy to do in Emacs, and it works reasonably well across most language modes. Example screenshots: http://david.rothlis.net/code_presentation/distracting_synta...

Re: The Definitive Guide to Syntax Highlighting

#10
There is a really great mode [0] for haskell that does the same thing as hl-sexp-mode. Oh and did I mention it fully supports structured editing? These kind of modes really make me question why programs are still written in text instead of ADTs... We don't need to run lexers and parsers to do our syntax highlighting and other fancy stuff... it would be awesome.

[0] https://github.com/chrisdone/structured-haskell-mode

Post reply on HN