<div dir="ltr">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.<br><div class="gmail_extra"><br><div class="gmail_quote">On 27 July 2016 at 15:00, Ludwig Schwardt <span dir="ltr"><<a href="mailto:ludwig.schwardt@gmail.com" target="_blank">ludwig.schwardt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>My excitement was tempered when I used it. The following happens on the latest master:</div><div><br></div><div><pre style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;border-radius:3px;color:rgb(51,51,51);margin-top:0px!important;margin-bottom:0px!important;background-color:rgb(247,247,247)"><code style="font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:11.9px;padding:0px;margin:0px;border-radius:3px;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal;background:transparent">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 </code></pre></div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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? :-)</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Ludwig</div><div><br></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/ipython-dev" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div></div>