[TxMt] bundle command pointers

Eric Abrahamsen eric at abrahamsen.com
Mon Sep 1 17:08:31 UTC 2008


Hi there,

Some people are working on updating Python and HTML-related bundles  
for Django, prior to Django's 1.0 release (http://www.bitbucket.org/bkerr/django-textmate-bundles/ 
), and I've got a bundle command problem where I'm hoping someone can  
point the way.

The idea is to provide some kind of automation for importing commonly- 
used functions and classes from Django's source code. Many of these  
objects are hidden fairly deep inside one module or another, and it's  
easy to forget which, leading to long tromps through the source code.  
I'd like to provide a command, perhaps similar to the HTML bundle's  
code completion command, which lets people either a) hit command- 
escape after the name of an object and view/paste its import path or  
b) start typing 'from django.', hit a key combo, and see a list of  
child modules, ideally letting them drill down into the modules until  
they find the object they're looking for.

I haven't written complicated bundle commands before and am not sure  
how to start this, in particular whether to go with route a or b. I  
can either manually build up a dictionary of objects and their import  
paths and then maintain that dict as Django evolves, or I can try for  
a command that actually searches Django's source code for the  
definition of an object. I'm leaning towards the former for two  
reasons: Having a list of objects would also serve for syntax  
highlighting, and also many objects are defined in one module, then  
imported into the __init__ file of another. They're 'supposed' to be  
imported from that second module, but a search function wouldn't know  
that.

Anyway, any general pointers and issues to consider would be much  
appreciated. I'd be writing the script in Python, naturally!

Thanks,
Eric




More information about the textmate mailing list