Updating for new CF9 script highlighting

7 views
Skip to first unread message

Russ Johnson

unread,
Dec 15, 2009, 3:48:49 PM12/15/09
to cftex...@googlegroups.com
Im doing alot of work with CF9 right now and something that is really bothering me is the lack of syntax highlighting for the new CFSCRIPT in CF9. It works fine for script inside of CFSCRIPT blocks but if you write a complete CFC in script without the tags, no highlighting.

I know enough to work with bundles and add functions, etc. but the language grammars are a mystery to me.

Has anyone thought about adding this level of syntax highlighting to the existing grammar? If not, does anyone know of a good reference for adding support to it? I dont mind tackling it, just havent been able to find any good reference for tweaking it.

Thanks in advance,
Russ

Steve Ross

unread,
Dec 15, 2009, 3:59:15 PM12/15/09
to cftex...@googlegroups.com
do it punk! just kidding russ.

best place to get help is irc under textmate, and just picking apart existing bundles (as3 one would probably be a good start)

-steve


--

You received this message because you are subscribed to the Google Groups "cftextmate" group.
To post to this group, send email to cftex...@googlegroups.com.
To unsubscribe from this group, send email to cftextmate+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cftextmate?hl=en.





--
Steve Ross
web application & interface developer
http://blog.stevensross.com
[mobile] (912) 344-8113 [fax] (404) 592-6885
[ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ]

Russ Johnson

unread,
Dec 15, 2009, 5:36:51 PM12/15/09
to cftex...@googlegroups.com
Well, this is turning out to not be as bad as I first thought it would. Of course I know the way I have it working is probably hackish but its working for now. And from what limited testing I have done, it actually improves the syntax highlighting of cfscript inside cfscript tags as well.

Im really not sure if this has any adverse side effects yet as I havent obviously tested it thoroughly but so far it seems to be working. I added code folding for functions and if statements so far but that could be expanded alot im sure.

if you try this out, let me know how it works. If you know a better way to handle this or how to improve on it, again, please let me know as Im just hacking trying to figure this out.

Here is what I did to get it working:

At the top of the language grammar change your foldingStartMarker and foldingEnd Marker to this:

foldingStartMarker = '(?x) 
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script |ul|ol|form|dl|cfloop|cfif|cfswitch|cfcomponent|cffunction|cfcase|cfdefaultcase|cfsavecontent)\b.*?> 
        |<!---(?!.*---\s*>)|function\s*|if 
        )';
foldingStopMarker = '(?x) 
(</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|scrip t|ul|ol|form|dl|cfloop|cfif|cfswitch|cfcomponent|cffunction|cfcase|cfdefaultcase|cfsavecontent)> 
        |^(?!.*?<!---).*?---\s*>|\} 
        )';

I simply added the selectors after the comment selectors. This could be added onto a ton Im sure.

For the syntax highlighting, I added this:

{ name = 'source.js';
begin = 'component|/';
end = '/}';
patterns = ( { include = 'source.js'; } );
},

right before this line in the grammar:

{ name = 'meta.tag.structure.any.html';

Should be pretty easy to setup and try if your doing any CF9 script work.

- Russ
Reply all
Reply to author
Forward
0 new messages