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:
// 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:
<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.