There are two ‘moving parts’ involved. First, there’s the syntax definition, which tells Sublime how to mark each part of a JavaScript file with a label called a “scope”. Then, there’s the color scheme, which tells Sublime how to color things based on their scope.
It sounds like you want to highlight the name of a variable in a variable declaration: e.g. foo
in var foo = 42;
. The JavaScript syntax definition currently marks foo
with the same scope as it would a variable in any other context, such as using foo
in an expression. This means that it isn’t currently possible to highlight it specially in a variable declaration. However, it would be possible to modify the syntax definition in a way that would make it possible, and by coincidence we’ve been discussing just such a change. My best guess is that it would go into effect two dev builds from now.
Once that is done, it may be that declared variable names are highlighted differently by default, or it may be that you’d need to add a line to your color scheme to do it. Which one depends on how we think that users would react to the change. Your request here certainly constitutes valuable input in that regard.