It depends. The javascript tmLanguage tries to highlight function parameters in six scenarios on quick observation.
- foobar: function() { … }
- “foo”: function
- Sound.prototype.play = function() { … }
- Sound.play = function() { … }
- play = function() { … }
- function myFunc(arg) { … }
Yours seems to fall in the last scenario where the regex is expressed as such:
\b(function)\s+([a-zA-Z_$]\w*)?\s*(\()(.*?)(\))
As you can see it requires at least one space after “function”. It could be rewritten, but you would have to play with it.
You could do:
\b(function)(\s+[a-zA-Z_$]\w*)?\s*(\()(.*?)(\))
But then the spaces would get include in the scoping of the function name.
You could try:
\b(function)(\s+([a-zA-Z_$]\w*))?\s*(\()(.*?)(\))
But then you will need to bump all of the selections by one except the first and not use the second selection (I am excluding selection 0 when I say first and second). I am not sure of the impact on the other highlighting if this change was made. Sometimes changing the rules can cause a cascade of unforeseen ripples due to the nature of how the theme files operate. You just have to play around with it.