Live data from Hacker News

Highlighting My Code Based on How Much I Care

hank.bond

21–30 of 73 posts

Re: Highlighting My Code Based on How Much I Care

#21
post #7

I am convinced everybody gets syntax highlighting wrong and this article backs me up. My pet peeves: - I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors. I'm too ADHD to want to be overly stimulated by useless information. - I routinely hate encountering Zig code on Github, where the theme they use turns everything brown. Oh it's becau…

> I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors.

That depends on what your use for syntax highlighting is. If you use it to find specific types of code, than yeah, it's probably unhelpful. But for me, the point of syntax highlighting is to just make reading easier by separating different parts of the code with different colors. I have absolutely no idea what each color means in my editor, it just matters that they're different.

Re: Highlighting My Code Based on How Much I Care

#22

I will always yap to anyone who will listen that I think syntax highlighting was a mistake that has cost humanity untold millions of productivity hours. I only highlight comments to distinguish code from not-code, I think everything else is a pretty distraction. Note how nobody ever got the idea to apply syntax highlighting to English or any other natural language, whether in books or on forums. I could believe synta…

The article touches upon this: > Unlike prose, where you usually read it linearly, with code you bounce around based on what connected elements you are exploring. The moment you are jumping around a lot while reading, being able to understand the structure quickly becomes a major help. For example, dictionaries will have the words in a bold font while italicizing things like the plural etc.

The punctuation/indentation already give you structure, all the highlighting does is break up the flow of actually reading. It essentially forces a micro-reset every second or third word rather than allowing you to seamlessly scan to find what you're looking for. It looks unreadable on the blog post because they have an unreadable font that is way too spacey (nothing against pixel fonts, just their particular choice of one...), but it really is way easier to read code if you try no highlighting with a real font.

I will caveat this on the fact that I use Allman brackets, and have even stronger opinions about that. K&R brackets are cancer and completely destroy the structure of code, so maybe that's why some people feel highlighting is necessary for "structure". With allman brackets, the punctuation guides your eyes to the indentation forming a clean box around each level of code, while if you draw a line from the opening bracket to the closing bracket with K&R style, half the code will be inside it and half outside it, bisecting the natural structure.

Re: Highlighting My Code Based on How Much I Care

#23
post #7

I am convinced everybody gets syntax highlighting wrong and this article backs me up. My pet peeves: - I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors. I'm too ADHD to want to be overly stimulated by useless information. - I routinely hate encountering Zig code on Github, where the theme they use turns everything brown. Oh it's becau…

>Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours. I think Prot's Emacs themes are good for this.

Yeah, I forgot to mention them, they're pretty good (though I use the muted colour preset, the default one is too vibrant)

Re: Highlighting My Code Based on How Much I Care

#24
Sorry, but I think that this is a completely made up problem. I've checked out the referenced Tonsky's article [0] and for me "colorful" examples are much easier to read than his suggested alternative.

Also, I had to use reader view for TFA because of this silly pixelated font. Ironic, considering that the article is about readability.

[0] https://tonsky.me/blog/syntax-highlighting/

Re: Highlighting My Code Based on How Much I Care

#25
post #7

I am convinced everybody gets syntax highlighting wrong and this article backs me up. My pet peeves: - I have no idea how people are supposed to be productive with non-semantic rainbow vomit themes that are so popular in modern editors. I'm too ADHD to want to be overly stimulated by useless information. - I routinely hate encountering Zig code on Github, where the theme they use turns everything brown. Oh it's becau…

> Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours. I want the same as you, but probably also the same as you; I'm too lazy to do it myself. Maybe do all of us an favor, and create that yourself and share it with us? I too prefer no syntax highlight than bad one, and m…

I have a crappy Emacs theme I built myself, inspired by Jon Blow's Emacs theme he uses on his stream which I find very peaceful to look at, but with a more bluish/indigo hue. It's full of bugs, so not comfortable sharing honestly, but I think it's worth spending an afternoon creating your own

Re: Highlighting My Code Based on How Much I Care

#26
lovely takes! even if the percentage of techies who reads & codes effectively outside coding agents is way way smaller; I think it would be cool to apply this for reading diffs! there might be some adjustments but, I might end up trying to apply principles on top of diffs (https://diffs.com/)!

Re: Highlighting My Code Based on How Much I Care

#27

Sorry, but I think that this is a completely made up problem. I've checked out the referenced Tonsky's article [0] and for me "colorful" examples are much easier to read than his suggested alternative. Also, I had to use reader view for TFA because of this silly pixelated font. Ironic, considering that the article is about readability. [0] https://tonsky.me/blog/syntax-highlighting/

Of course it's a made up problem, most ultimately are. Programming (and life) are full of bike sheds for those with eyes to see them, does that mean they should not be painted?

Re: Highlighting My Code Based on How Much I Care

#28
These rethinking-highlighting posts always start out with the wrong premise. The color for class names in my code is the color all the class names have. After a short time working with the code I would notice if one looked off. The brain is really very efficient. You don’t optimise for random out of context recall unless you really try hard to do so. It says nothing about the efficacy of the scheme.

Re: Highlighting My Code Based on How Much I Care

#29
post #11

Good article, enjoyed it. I might give this idea a shot! > Comments: these contain high level descriptions (faster than reading the code) and external context (the “why” that reading code can’t answer). This is the most scannable thing in any big code file. Not sure about that one, depending on comment culture. Comments are prose and not structured, so to understand their meaning is a lot more cognitive load for me t…

I totally agree with you about the comments. Code is so much easier to grok. The comments are there as a reference that you can concentrate on if the code doesn't make sense to you.

Re: Highlighting My Code Based on How Much I Care

#30
post #25

Earlier quoted context omitted.

> Always seeking good, minimal, muted colour themes for my editors. I wish we had serious designers to design themes for usability and comfort, and not people that have no business playing with colours. I want the same as you, but probably also the same as you; I'm too lazy to do it myself. Maybe do all of us an favor, and create that yourself and share it with us? I too prefer no syntax highlight than bad one, and m…

I have a crappy Emacs theme I built myself, inspired by Jon Blow's Emacs theme he uses on his stream which I find very peaceful to look at, but with a more bluish/indigo hue. It's full of bugs, so not comfortable sharing honestly, but I think it's worth spending an afternoon creating your own

[deleted]
Post reply on HN