Remix.run Logo
cosmic_cheese 7 hours ago

Feels like a difference in mental structures. Without robust syntax coloring, parsing code is considerably more difficult for me. In more human terms it feels kind of like trying to communicate without being able to use adjectives or something.

piskov 6 hours ago | parent [-]

It took a couple of days 10+ years ago to see what the fuss is about (I was an avid “christmas-lighter” before), and I never came back.

Also check this: https://tonsky.me/blog/syntax-highlighting/

D-Machine 6 hours ago | parent | next [-]

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.

piskov 6 hours ago | parent | next [-]

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.

D-Machine 4 hours ago | parent | next [-]

Code can be read without any syntax highlighting or text decoration, obviously. But adding those things is an additional information stream that makes processing faster and more reliable (redundancy in general has this effect).

As you said, it is especially useful for making certain code smells instantly visible at a glance.

I also find that different kinds of code will get different "color rhythms" (e.g. low-level algorithmic code vs. high-level code that calls a lot of functions vs. code that does a lot of operations / mutation of object or class properties) when syntax highlighting is properly semantic. This makes scanning for certain types of things (where objects are being mutated, where variables are introduced, etc) extremely fast, since you don't even need to read the characters.

I also find that rich syntax highlighting makes the codebase easier to remember, since the color (along with things like the line-lengths) gives each function a sort of unique visual texture.

Of course, all of this is personal preference. I am a very visual thinker so this kind of stuff helps a lot for me. Some people are far more verbal in their mental imagery or may remember code chunks solely based on semantics. Then, obviously, a bunch of color and/or text decorations might not matter much, or even just be a distraction.

cosmic_cheese 5 hours ago | parent | prev | next [-]

In my usage, the coloring allows my eyes to “snap” to relevant chunks of code and restrict scanning to the bounds of those chunks.

Functionally it seems similar to spatial memory where landmarks are used as navigation shorthand and is impaired in circumstances where everything looks the same (e.g. in one of those sprawling suburbs with 100 of the same house).

genocidicbunny 4 hours ago | parent | prev | next [-]

I remember colors better than I remember names. It's a difference in how I process text, and for code where there's already 'types' of syntax, colors help differentiate between all those. It's not that I can't find the for loop, it's just that visually it becomes more distinct to me if all loops are a certain color. And class names are a certain color. And those colors tend to stand out better on a dark background than a light one. Reading light themes, or even unthemed code just feels like an additional chore that's solved pretty simply by using a dark theme.

satvikpendem 5 hours ago | parent | prev [-]

No one needs it, but it's nice to have. It's the difference between being partially or fully colorblind or not being so, in terms of being able to distinguish parts of the codebase more easily. That is what the parent means by "easier to parse code."

> I like cursive though to highlight variables that are assigned more than once

Exactly, everyone is different, as personally I'd hate cursive and ligatures. Think of it as, what works for you doesn't work for everyone, and what works for them (color) doesn't work for you. But let people have their preferences.

piskov 5 hours ago | parent [-]

> as personally I'd hate cursive

Exactly the reason to fix the code so that there is only a single assignment and therefore no cursive :-)

chausen 5 hours ago | parent | prev | next [-]

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.

D-Machine 4 hours ago | parent [-]

I'd need a citation for that statistic, and I'd also need to see which themes are actually used.

> IMO, the best themes do typically have minimal/functional highlights, which results in more text that is the base color

And IMO, those are the worst themes.

These things are just preferences, but it is an objective fact that a good highlighting scheme makes certain information immediately visible, without requiring the reader to parse the actual characters. Whether or not this information is something you find helpful or annoying depends on your processing styles and preferences.

satvikpendem 5 hours ago | parent | prev [-]

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.

6 hours ago | parent | prev [-]
[deleted]