Sublime Forum

Inconsistent coloring in 2126 and 2135

#1

Hi,
first of all I want to say Sublimbe Text 2 is an awesome editor. Have been using it since yesterday and I’ll definetely convince by boss to buy me a license, because this peice of sofware is what I’ve been searching for a long time.
There’s some weird behaviour in coloring in this Javascript file though. This is not color scheme specific. I doubt that this is intended behaviour, so I hereby report it. See //comments

http://www.dumpt.com/img/files/lr6ganva5m5wwk2tzz1d_thumb.png

[code]var namespace = {};

namespace.SomeClass = function() {

this.method = function() {};

this.property = "doing"; // no colouring for "this" before properties?

this.func3 = function() {
	this.method(); 
};

 // why "method" different color when calling than
 // when creating (on top)? Why "this" no coloring?
this.method();

this.someObj.doSome = function() { // even weirder coloring
	
}

}[/code]

Keep it up!

Christian

ps. the code folding triangles are not positioned at the right places either. I know 2135 is a dev build …

0 Likes

#2

It is quite consistent. The regex to color the function deceleration is “green” (parent members will be blue) and functions actually being called are blue (parent members are not distinguished in this case).

These things can be tweaked in the javascript language file, the colors are simply based off of searching for patterns with regex and then applying a scope to the found targets. If you prefer the deceleration and the call to be the same color, then I would suggest modifying the scope in your language file or change the color of the scope of the deceleration in your theme file. You could also rewrite the regex patterns to search and identify targets how you like.

Highlighting is kind a personal preference thing. I know some people who don’t like too many colors and like to have things only minimally highlighted, also, I know people that like everything distinguished. I guess if enough people agree, you might be able to get it changed across the board, but I believe that unless the highlighting is blatantly flawed, you might have an easier time just modifying it and offering it has an alternative to the default highlighting.

0 Likes