Hacker News new | past | comments | ask | show | jobs | submit login

I have 2.5 major distinctions made in my syntax highlighting, and it's common to almost all languages for me:

Comments are a shade that's near the background: I can read them if I focus on them, but otherwise they're not present when I'm reading code

Strings are a colourful colour, because the next visual distinction I want is between what's an operation or name, and what's data or literal. Numbers don't get this treatment because they're sufficiently obvious on their own.

The base text colour has a small distinction between keywords (darker) and everything else (lighter).

Sometimes I'll pull in another colour if I'm in something like Python for things like decorators, to create a distinction between code and meta-code.

This takes care of 95% of the visual distinguishing that's useful, and the rest is noise that adds cognitive load to track. As a bonus, because it's common to all languages in which I work, switching is easy because almost every language breaks down nicely between these categories.




If making comments invisible is at all helpful, they’re being seriously misused. Comments are supposed to explain what’s going on, and thus make things easier. Hiding them should be very counter-productive.


As pYQAJ6Zm says: they're not invisible, but when I'm looking at code, they're easily ignored, and when I'm looking at comments, they're easily located. Using solarized dark, the background is Base 03 'bright black' (#002833) and the comments are Base02 'black' made a bit lighter (#004f62).

Comments are for holding details: I shouldn't need them to understand code, at least superficially/structurally. But they should be there if I need to drill down on something a bit, and making it so that focusing on that extra detail is easily skipped or applied makes the overall code reading much more fluid.


I do the same thing. It’s not as much hiding the comments as making them less attention-grabbing when they are not needed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: