[TxMt] Text autocomletion, BBAutoComplete

Jeroen van der Ham jeroen at je-ju.net
Tue Aug 9 15:20:12 UTC 2005


On 09-08-2005 15:35, Sune Foldager wrote:
> On 09/08/2005, at 9.55, Jeroen van der Ham wrote:
> 
>> For Python it would work best if the script that generates the 
>> candidates
>> is written in Python, because of the easy introspection that is  possibly
>> within Python.
> 
> 
> Except that introspection usually (always?) works with the _current_ 
> program, so the completer would need to somehow load the completee in 
> order to gain any advantage from introspection; unless there is some 
> magic in Python I don't know about. In ruby it would be like this, at 
> least.

That's true.
What I do in the python completion currently is grab the current line and
the import statements. Using that it figures out if the match should come
from a library and uses introspection on that library to generate candidates.

Which reminds me, I'd like to be able to provide candidates for 'empty'
words as well. The usage scenario would be that someone types the name of
the library, followed by a period and then uses <esc> to loop through all
the functions defined in there. (if you're too lazy to remember what the
name started with, but still know what library it came from).

This currently is not possible because the '.' is a word delimiter and
therefore "sys.|" is considered an empty word, while lots of candidates
can easily be provided for it.

Jeroen.

-- 
            <http://www.je-ju.net/~jeroen/blog/>



More information about the textmate mailing list