Sublime Forum

Ideas for better syntax highlighting

#1

Thoughts on this?

The only first grade color scheme I could find that makes comments prominent is dink donk. Thinking of making my own but maybe there are more quality color scheme out there that actually care about proper code.

In many languages it would also be useful to have different color for == and =. I’m sure there are other examples.

0 Likes

#2

Well comments being colored differently is easy enough to do if someone wanted to do that. I don’t know that I agree on his examples on bloated commenting. Coming from a background in code maintenance, even the things that appear as if they are “redundant” are frequently still a good idea. If I’m picking up a project from ten years ago to make some surgical changes and/or upgrades, having even relatively simple comments saying “This procedure generates the delay needed for processing the command.” over a function called “CommandProcessDelay” it’s still extremely useful because I don’t necessarily need to go tracking through the code to make sure that this is or isn’t the function I need to alter.

Clearly there are dumb comments like “Incrementing the counter” over a “i = i + 1” statement, but a comment like “The counter makes sure we never execute this more than 20 times otherwise it fails.” adds context and reason for why a statement exists.

In general, from a maintenance perspective, not assuming your code is “expressive” enough to handle five to ten years of forgetfulness and adding in additional explanatory commentary is beneficial. Whether or not one wants their lexical highlighting to bring comments to the fore is individual preference.

4 Likes

#3

I think you are attacking a straw man. If you carefully read the linked article, you can notice two types of comments mentioned. The useful ones which need to stand out, and the unnecessary ones, which hinder readability and should be removed.

Perhaps giving comments more visibility in default schemes would encourage programmers to write useful comments a la literate programming.

0 Likes

#4

Each programmer chooses a color scheme, whether the color scheme hides comments or not, it up the programmer which chose the color scheme. I ported, or at least tried to port in some sort of the Notepad++ color scheme, I do not think that it contrastas the comments more than the code itself:

0 Likes

#5

I don’t think I’m attacking anything really. There are two main thrusts to the article:

  1. Comments are important. I agree with this, and even find some of his “unnecessary” comment examples potentially necessary and/or useful when taken in context of maintaining a code base for a very long time with multiple developers (per my reply.) Largely though, I think comments are really important. I’ve been the victim to too many code bases where developers thought they were being super clever and their code was “expressive” in sufficient manner to demonstrate what was going on, when in reality it wasn’t, or obscured some nuance or requirement that should have been documented expressly. And even if the code is expressive, a comment saves me time by adding context or is simply faster to read than parsing some lengthy function or method name.

  2. Because comments are important, color schemes should make comments stand out boldly in some fashion to denote their importance. On this subject I believe this is personal preference. I can see the argument, but I do not find it compelling. I am quite satisfied with my own color scheme choice that puts comments in a low-contrast state. However that’s the beauty of programmable color schemes and if one wishes to have a comment-centric color scheme, that’s quite easy to accomplish.

At most, it might be interesting to have a color scheme toggle where we could switch between a code-centric color scheme, and a comment-centric color scheme. That might be interesting, though I’d have to experiment with it in practice to see if it was valuable to me.

4 Likes

#6

I think both are important! Here is how I modify all my highlighting. It allow for both “headlines” and greyed out comments. I find this distinction extremely useful. In javascript // are headlines and /* comment */ are greyed out comments.

4 Likes