logoalt Hacker News

D-Machinetoday at 12:11 AM3 repliesview on HN

This is a pretty awful post, the problem is his example uses a horrible syntax highlighting scheme that makes use of far too few colours and no other text decorations.

In a competent highlighting scheme, you have enough differentiation that every distinct type of thing indeed has a different way it pops.


Replies

piskovtoday at 12:31 AM

Why though?

You don’t see a for loop? Or don’t know where is the variable and where is the method? The list goes on. Never in my life I need a color to differentiate between a class name and a variable (they already differ in first-letter case). Or between language keyword and a variable (I’m not 5, I know those keywords by heart).

There is a reason we use nouns for variables, verbs for methods, stuff like isReady or hasAccess for booleans and what have you.

Color is overrated (or rather very nice for stuff that matters: like comments).

I like cursive though to highlight variables that are assigned more than once (bold cursive if it is a parameter, god forbid): instant attention to what is usually a code-smell.

show 4 replies
satvikpendemtoday at 1:00 AM

Agreed, they should be using color schemes that are TreeSitter compatible so for example "React" and "window.React" are not the exact same color, as they are semantically two different things.

chausentoday at 1:46 AM

99% of vscode themes are like the one he showed. IMO, the best themes do typically have minimal/functional highlights, which results in more text that is the base color.

show 1 reply