[TxMt] Re: TextMate Code Completion

Maarten Sneep maarten.sneep at xs4all.nl
Thu Dec 7 00:12:03 UTC 2006


On 7-dec-2006, at 0:39, Jacob Rus wrote:

> For C, there's some generic set of functions that should be  
> included (probably similar to those in the "C Library" bundle, but  
> I would also like to support arbitrary header files sourced in the  
> current file.  The snippets inserted by the "C Library" bundle do  
> just about what they should do, but of course, we should be able to  
> complete before typing the full function name.  Also, ordering the  
> list will be a bit tricky. I don't think it should just be  
> alphabetical; for instance, functions already used in the current  
> document should come sooner than others.

Here is some experience from the outside, BBEdit to be precise.  
BBEdit does not offer code or even word completion (at all). An  
external tool is available to soften that blow [1]. If apple events  
are available, it is possible to hook it up to TextMate.

In my experience it works well enough for LaTeX code where you have a  
lot of private macros (in which case a list of additional names is  
useless anyway). Just make sure you have the file with the  
definitions open, and the command definition alone is enough to find  
the right completion.

For programming where a lot of the required word-lists may be from  
external libraries, this is less useful (although it certainly  
promotes the use of long variable names, generally improving code  
readability). Since the file contents are all passed along through  
AppleEvents, it should be easy to capture the call, and fake a  
document with all library function names. The order in which possible  
completions are found is working, and worth copying. Right now  
repeated calls cycle through possible completions, an Xcode like drop- 
down menu is probably a bit better in the long run.

HTMH,

Maarten

[1] http://c-command.com/bbautocomplete/





More information about the textmate mailing list