sublimetext2 - Adding syntax highlighting to Sublime Text for JavaScript - Stack Overflow

i have a single problem, in my sublime text 2 the syntax highlight of javascript takes this codethis.in

i have a single problem, in my sublime text 2 the syntax highlight of javascript takes this code

this.init = function(){};
this.init : function(){},

painting of "this" in lightblue and "init" in green...

but in this case...

this.init = null;
this.init : null,

is not happening... i want to highlight "this.*" in all cases of use...

like for example

this.init = function()
this.init : function()
this.init : true
this.init = true

how can i do that???

i have a single problem, in my sublime text 2 the syntax highlight of javascript takes this code

this.init = function(){};
this.init : function(){},

painting of "this" in lightblue and "init" in green...

but in this case...

this.init = null;
this.init : null,

is not happening... i want to highlight "this.*" in all cases of use...

like for example

this.init = function()
this.init : function()
this.init : true
this.init = true

how can i do that???

Share edited Aug 19, 2014 at 0:56 Ben McCormick 25.7k12 gold badges55 silver badges71 bronze badges asked Aug 30, 2013 at 1:07 andrescabana86andrescabana86 1,7888 gold badges32 silver badges56 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

The default syntax highlighting for javascript in Sublime is not great.

I use JavascriptNext: https://github./Benvie/JavaScriptNext.tmLanguage

It improves on the default syntax hightlighting and also adds support for future ES6 syntax.

In your particular case it is more consistent on the coloring of the if values, though less consistent on the property values for the : syntax. But I think thats ok since its not actually valid syntax anyhow.

Adding to ben336's answer, I tested your code with my Neon Color Scheme and a few different JavaScript language definitions, including JavaScriptNext, which actually did look the best:

The scopes for the init method are interesting (all are source.js, of course) -

this.init = function(); // meta.property.js variable.other.property.js
this.init : function(); // meta.function.js meta.function.json.js entity.name.function.js
this.init : true; // meta.function.js constant.other.object.key.js string.unquoted.label.js
this.init = true; // meta.function.js meta.property.js variable.other.property.js

Since the last 3 are function scoped they should be colored bright green, but the third one has a string scope and the last one a variable.other scope, so they pick up those colorings instead.

If you'd like, I can try to finagle the theme's function scope selectors to color the last 3 consistently - just open an issue or let me know here and I'll see what I can do.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745057674a4608769.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信