[TxMt] Better JavaScript functions

Andreas Wahlin andreaswahlin at bredband.net
Thu Oct 13 08:05:52 UTC 2005


Sadly, the below does not allow for symbol navigation on the more  
fancy function declarations, it's not at all critical, but it would  
be somewhat nice :)
However, it does capture the scopes of stuff correctly, so syntax  
colouring is better, yay!

Andreas


>> [...] if *I* were writing the syntax highlighting regexp, I think  
>> I'd be lazy and simply do:
>>
>
> Thanks, so I'll be committing this patch:
>
> Index: JavaScript.plist
> ===================================================================
> --- JavaScript.plist (revision 1895)
> +++ JavaScript.plist (working copy)
> @@ -39,7 +39,7 @@
>             </dict>
>          </dict>
>          <key>match</key>
> -        <string>^\s*(function)\s+([a-zA-Z_]\w*)\s*\(([^)]*)\)</ 
> string>
> +        <string>\b(function)(\s+[a-zA-Z_]\w*)?\s*\((.*?)\)</string>
>          <key>name</key>
>          <string>meta.function.js</string>
>       </dict>




More information about the textmate mailing list