[IPython-dev] Function specific hooks into the ipython tab completion system
Sat Dec 1 20:24:11 CST 2012
My PR is up for this feature now, here.
One thing I discovered when working on the code for this feature is that I think the IPython completer code could use some refactoring.
With this PR, there are/will be three independent hooks into the completer system. One of them is is what's used for `import` and `cd` and also provides a somewhat user facing hook API (`get_ipython().set_hook('custom_completer', ...` and `IPython.core.completerlib.quick_completer`).
Another way of interacting is via interactiveshell.set_custom_completer, which, confusingly, is NOT the same mechanism as `get_ipython().set_hook('custom_completer', ...` (!!).
And now there's this new feature. It's a bit of crazyness.
Because none of the completer methods are talking to each other effectively, there's some duplication of effort. For instance, before any of the completers get called, the input line of code is split on delimiters, but only the last element is saved and passed around. So completers that need more info need to reparse the line. The obvious parsing to do is tokenizing the line, but if two completers need to do that, they don't currently have any way to share the tokens, so the tokenizer will just get run twice.
From working on this new feature, I have some idea of what could be done to improve the situation.
Is it important to maintain full backwards compatibility with the `get_ipython().set_hook('custom_completer', ...` / `IPython.core.completerlib.quick_completer` API? (Is anyone using that in the wild?)
On Nov 30, 2012, at 3:55 PM, Robert McGibbon wrote:
> Awesome. Keep me in the loop! I'm happy to play a support role.
> On Nov 30, 2012, at 3:51 PM, Thomas Kluyver wrote:
>> On 30 November 2012 23:47, Robert McGibbon <firstname.lastname@example.org> wrote:
>> If someone else wants to try to get this discussion going in the wider python community, I'm all ears. But I don't
>> think that person is going to be me.
>> I might do that. Thanks for your thoughts - I look forward to seeing the results.
>> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev