[TxMt] Javascript syntax enhancement
Aparajita Fishman
aparajita at aparajitaworld.com
Fri May 12 16:39:01 UTC 2006
Hi,
I would like to suggest the following enhancement to the Javascript
syntax:
{ name = 'meta.function.js';
comment = 'match stuff like: foobar: function() { … }';
match = '^\s*\b([a-zA-Z_?\.$]+\w*):\s+\b(function)?\s*\((.*?)\)';
captures =
{ 1 = { name = 'entity.name.function.js'; };
2 = { name = 'storage.type.function.js'; };
3 = { name = 'variable.parameter.function.js'; };
};
},
Since the common style in a lot of Javascript libraries (like
Prototype/scriptaculous) is to define functions like this:
var Enumerable = {
each: function(iterator) {
// body
},
all: function(iterator) {
// body
}
}
The above rule correctly highlights these definitions and also
includes their names in the function popup.
Regards,
Aparajita
www.aparajitaworld.com
"If you dare to fail, you are bound to succeed."
- Sri Chinmoy | www.srichinmoylibrary.com
More information about the textmate
mailing list