Sublime Forum

Wrong JavaScript.tmLanguage file

#1

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.

0 Likes

#2

The best thing you can do is to send a pull request here github.com/textmate/javascript.tmbundle

0 Likes