Re: _ipython_key_completions_ has unexpected behaviour

Thomas Kluyver <[email protected]> Wed, 27 Jul 2016 21:44:06 +0100
Newsgroups gmane.comp.python.ipython.devel
Message-ID <CAOvn4qgGk2pzGeT=XWa2YEasjYNO8GO5tV7u1URY0WYujtXPRQ@mail.gmail.com>
The whole completion system is in dire need of an overhaul to make it more
flexible. However, I don't think this is as problematic as it seems - tab
completion is only useful with names of more than a couple of characters,
and then the ambiguity will disppear rapidly.

On 27 July 2016 at 15:00, Ludwig Schwardt <[email protected]> wrote:

> Hi,
>
> I am very excited about the new custom dict key completer as it
> potentially replaces many lines of brittle code in my libraries dating back
> to before IPython 0.10.
>
> My excitement was tempered when I used it. The following happens on the
> latest master:
>
> In [6]: class A(object):
>    ...:     def _ipython_key_completions_(self):
>    ...:         return ['x', 'y']
>    ...:
>
> In [7]:
>
> In [7]: a = A()
>
> In [8]: a['x
>              x      %xmode
>              %xdel  xrange
>
>
> I expected the list of options to include only strings returned by
> _ipython_key_completions_ but instead it gives the whole shebang of
> filenames, Python keywords, magics, etc.
>
> On inspection of the source it seems that all matchers are used unless a
> custom completer is registered (which is my current setup). Alternatively,
> the merge_completions=False config option will only return the results of
> the first successful matcher but since dict_key_matches is the last matcher
> this will also not help.
>
> I would like dict_key_matches to be the only matcher if
> _ipython_key_completions_ is defined, without resorting to config
> overrides. Am I the only one? :-)
>
> Thanks in advance,
>
> Ludwig
>
>
> _______________________________________________
> IPython-dev mailing list
> [email protected]
> https://mail.scipy.org/mailman/listinfo/ipython-dev
>
>

_______________________________________________
IPython-dev mailing list
[email protected]
https://mail.scipy.org/mailman/listinfo/ipython-dev