A few days ago I posted about using qlcolorcode to display syntax highlighted ColdFusion code in Mac OS X’s Finder’s quick look. Now – I had a bit of a look into how to use/extend the same plugin for displaying Action Script and MXML code as well.
Qlcolorcode already has built-in support for Action Script (although it’s not complete and really 100% correct for AS3 as it appears to me), but it’s supposed to do the trick. I ran into the issue that it unfortunately didn’t work for me. A bit time spent looking around and playing with the default application to open .as files on my Mac brought up the following blog post. Of particular interest are the comments:
http://www.n8gray.org/blog/2008/01/07/qlcolorcode-041/
I can just speak for Snow Leopard and in that case you’d want to look into comments 8, 12 and 18. Basically after this step the relevant section in my Info.plist in the Qlcolourcode plugin package looks as below and syntax highlighting for Action Script works (sort of):
CFBundleDocumentTypes
CFBundleTypeRole
QLGenerator
LSItemContentTypes
public.source-code
public.xml
com.apple.property-list
org.tug.tex
public.plain-text
com.apple.applesingle-archive
The next step was to get MXML working. That’s a bit trickier because it’s not yet built-in into the plugin. Luckily Qlcolorcode supports XML and as MXML is a proper, fully XML-compliant language it can’t be too hard to enable it for MXML. The good thing is – someone has done it before:
http://playground.deju.nu/2008/10/os-x-quick-look-for-mxml-files/
The bad thing – this is for OS X 10.5 and it didn’t work out of the box for me. In general I’d recommend to follow the descriptions in there. The command to run in step 5 on OS X 10.6 would be different though:
qlmanage -d3 -p yourmxmlfile.mxml 2>&1 | grep 'Generator used'
Also the path used in step 8 had to be different for me. Instead of Resources/highlight/etc/highlight/ the filetypes.conf would have to be looked for in Resources/etc/highlight/. Also in my version of the file the file type definitions for xml and html did look differently:
$ext(html)=htm xhtml
$ext(xml)=sgm sgml nrm ent hdr hub dtd wml vxml wml tld svg xsl ecf jnlp mxml
As you can see, I added the mxml file suffix to where it made much more sense imho. From here on just follow the instructions and you should be good to go.
This should provide a working solution – not necessarily a perfect one as the highlighting for AS 3 is not quite right and it would be nice to tweak the syntax highlighting for MXML and CF; some new CF tags are not properly picked up etc. I might have a look into that – it’s not too hard actually because qlcolorcode uses highlight internally. Will keep you posted 🙂
This is probably a stupid question, but how do I locate and edit the Info.plist in the Qlcolourcode plugin package? Do I need a special editor?
@Mike – not a stupid question at all. Secondary-click the file in Finder, select “Show Package Contents” – that gives you access to the bundle’s content. Drill down in the folder structure and you’ll find the Info.plist in /Contents and some more interesting stuff in /Contents/Resources.
Comments on this entry are closed.
{ 2 trackbacks }