[TxMt] Javascript syntax enhancement

Andrew Dupont andrew at andrewdupont.net
Fri May 12 18:22:55 UTC 2006


Justin Palmer's Vibrant Ink bundle [1] includes a small syntax addon  
for this sort of construct.  With his blessing, I've made tentative  
plans to move some of this into the main JavaScript bundle.   
Someday.  Meanwhile, you can use his.

[1] http://encytemedia.com/blog/articles/2006/01/03/textmate-vibrant- 
ink-theme-and-prototype-bundle

Cheers,
Andrew Dupont
<http://andrewdupont.net>



On May 12, 2006, at 11:39 AM, Aparajita Fishman wrote:

> 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
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list