Live data from Hacker News

Highlighting My Code Based on How Much I Care

hank.bond

61–70 of 73 posts

Re: Highlighting My Code Based on How Much I Care

#61
post #37
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…

Completely with you. I've played with limited syntax highlighting in the past (class names were blue, to answer the question in TFA), but for the past few years I've been running with plain black-on-white, with only a green highlight for comments, and a subtle yellow for strings. https://i.xkqr.org/lighttheme.png I think the relatively bold highlighting of comments is important – lots of times I'm the only person to…

I get the origins of low contrast comments - auto-generated stuff in old Java code was basically a box ticking exercise to please checkers that only checked if comments were available, probably for javadoc purposes, making these comments useless noise.

But that's only Java, and I want to believe most people moved away from box ticking exercises like javadoc blocks. Comments should be important and thus high contrast.

Re: Highlighting My Code Based on How Much I Care

#62
(If it's not just for reading / presentation and you're actually working with the code)

using underlining / background color as part of syntax highlighting will conflict with LSP/IDE diagnostics unless their presentation is redone as well. many editors don't provide that control

Re: Highlighting My Code Based on How Much I Care

#64

i'm actually curious if anyone has explored syntax highlighting with ML. doesn't have to be an LLM, but something that actually highlights what's interesting, or even strange, about a code snippet.

I did somewhen toy with the idea of comparing how a line of code is written to what an LLM-based next-token-prediction would emit for the same line. Then it might be possible to highlight the pieces of code that most differ from what an LLM would have written.

The base form isn't too useful by itself, but I expect if one would "seed" the LLM with a prompt about focusing specifically on a particular class of errors, it might be possible to find violations by seeing where the code completely deviates from what an LLM would have written.

Never got around to doing anything with this, but I expect a prototype should take no more than a day with some agent-assisted coding ;) Tell me how it went if you try!

Re: Highlighting My Code Based on How Much I Care

#65
post #37
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…

Completely with you. I've played with limited syntax highlighting in the past (class names were blue, to answer the question in TFA), but for the past few years I've been running with plain black-on-white, with only a green highlight for comments, and a subtle yellow for strings. https://i.xkqr.org/lighttheme.png I think the relatively bold highlighting of comments is important – lots of times I'm the only person to…

Thanks for sharing I love this theme. Implementing it now this morning and really appreciate the middle ground between no highlighting and the popular rainbow chaos themes.

Re: Highlighting My Code Based on How Much I Care

#67

I like highlighting only the language concepts: Reserved words are red Strings are green Constants/numbers are blue Types/meta-language are yellow Anything else is white. It’s not too colorful but still gives you plenty of anchors for your eyes.

I use the default neovim theme and I feel that's essentially what I get out of it. Feels like sometimes I don't have highlighting enabled.

Re: Highlighting My Code Based on How Much I Care

#68
If rule-based highlighting of syntax is meaningfully helpful for reading code then how come nobody uses rule-based syntax highlighting of prose?

Why don't we visually emphasize the verb in a sentence and deemphasize articles and prepositions, for example?

In prose the author can *bold* or italicize text to emphasize ad-hoc, or make ## headings for scanning. Why can't we do such ad-hoc emphases in code?

Re: Highlighting My Code Based on How Much I Care

#69

If rule-based highlighting of syntax is meaningfully helpful for reading code then how come nobody uses rule-based syntax highlighting of prose? Why don't we visually emphasize the verb in a sentence and deemphasize articles and prepositions, for example? In prose the author can *bold* or italicize text to emphasize ad-hoc, or make ## headings for scanning. Why can't we do such ad-hoc emphases in code?

one time i made a nlp-based syntax highlighter for english ebooks, and it was pretty interesting.

in using it, i believe that it's a little handholdy and reduces expression when every word has some color based on it's part of speech. intentional application of this would be incredibly fun to read, if not incredibly tedious to write

Re: Highlighting My Code Based on How Much I Care

#70

If rule-based highlighting of syntax is meaningfully helpful for reading code then how come nobody uses rule-based syntax highlighting of prose? Why don't we visually emphasize the verb in a sentence and deemphasize articles and prepositions, for example? In prose the author can *bold* or italicize text to emphasize ad-hoc, or make ## headings for scanning. Why can't we do such ad-hoc emphases in code?

one time i made a nlp-based syntax highlighter for english ebooks, and it was pretty interesting. in using it, i believe that it's a little handholdy and reduces expression when every word has some color based on it's part of speech. intentional application of this would be incredibly fun to read, if not incredibly tedious to write

I saw a dyslexic/speed reading app that did something like this once. I don't know how useful that was in practice, but the theory of it was pretty compelling. Most sight reading is based on the overall shape of the word (rather than the component letters, we rarely actually read letter at a time [0]), and for different reasons word shape alone is still to slow for dyslexic and speed readers, so adding an extra channel of color can help speed up reading for both audiences of reader.

[0] Which is why UPPERCASE TEXT is a reading speed bump for almost all readers because word shapes blur together into "just rectangles" more. Which is also why the "slow reveal" pattern in most visual novel genres is often very wrong for English text. (Most simply reveal character at a time which makes sense for CJK ideograms because one character is at least a full syllable if not also a full word. When the pattern was copied to English translations it probably should have been done word at a time rather than character at a time.)

Post reply on HN