Home Download Buy Blog Forum Support

Wrong JavaScript.tmLanguage file

Wrong JavaScript.tmLanguage file

Postby sammy on Wed Mar 21, 2012 4:25 am

I noticed that anonymous function argument lists where not being scoped properly when there was no space between the keyword funciton and it's argument list:

Code: Select all
// the string "arg, list" does not get scoped and therefore not highlighted
function(arg, list) {
}
// but this does
function (arg, list) {
}
 


This is obviously false, because JavaScript doesn't require a space there. I had a look at the JavaScript.tmLanguage file and I found that if I change line 260 to:

Code: Select all
         <string>\b(function)(?:\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\))</string>


It fixes the issue! I hope this helps the sublime text project. Please use this fix for the JavaScript.tmLanguage file, bundled with Sublime Text 2.

I'll append this post if I discover anything else wrong with the JavaScript.tmLanguage file.
sammy
 
Posts: 11
Joined: Wed Mar 07, 2012 9:40 pm

Re: Wrong JavaScript.tmLanguage file

Postby tito on Wed Mar 21, 2012 5:06 am

The best thing you can do is to send a pull request here https://github.com/textmate/javascript.tmbundle
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 34 guests