<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le 18 déc. 2012 à 10:52, Robert McGibbon a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Matthias,</div><div><br></div>Good call. That's it exactly. Unfortunately,&nbsp;I think dealing with this issue is a little above my expertise/experience.<div><br></div><div>When I apply this patch (pasted below) to the PR, the tab completions show in the notebook for foo(&lt;TAB&gt;.</div><div><br></div><div>The problem is that behavior kind of conflicts with the tooltip feature, which is not a feature of the terminal console.</div></div></blockquote><div><br></div><div>without your patch,&nbsp;</div><div>You could set&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>this.tooltip_on_tab = true;</div><div>L25 in codecell.js to false.&nbsp;</div><div>It will trigger the tooltip only if you stay after a opening bracket for a certain amount of time.</div><div>The the completer should work as expected.&nbsp;</div><div><br></div><div>It should be made configurable.&nbsp;</div><div><br></div><div>we could try to tweak the behavior so that (&lt;tab&gt; trigger tooltip</div><div>([space]&lt;tab&gt; trigger completion.</div><div><br></div><div>But I guess that's beyond the extend of your PR.</div><div>--&nbsp;</div><div>Matthias</div><div><br></div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>-Robert</div><div><br></div><div>p.s.</div><div><br></div><div><div>I think I'm finally starting to see the wisdom of the comment on line 1046 of IPython/core/complete.py,</div><div><br></div><div><div></div><blockquote type="cite"><div>&nbsp; &nbsp; &nbsp; &nbsp; # FIXME: we should extend our api to return a dict with completions for</div><div>&nbsp; &nbsp; &nbsp; &nbsp; # different types of objects. &nbsp;The rlcomplete() method could then</div><div>&nbsp; &nbsp; &nbsp; &nbsp; # simply collapse the dict into a list for readline, but we'd have</div><div>&nbsp; &nbsp; &nbsp; &nbsp; # richer completion semantics in other evironments.</div></blockquote></div></div><div><br></div><div><div>$ git diff</div><div>diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js</div><div>index ea34719..000734b 100644</div><div>--- a/IPython/frontend/html/notebook/static/js/codecell.js</div><div>+++ b/IPython/frontend/html/notebook/static/js/codecell.js</div><div>@@ -155,6 +155,8 @@ var IPython = (function (IPython) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IPython.tooltip.request(that);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Prevent the event from bubbling up.</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;event.stop();</div><div>+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log('RTM DEBUG');</div><div>+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.completer.startCompletion();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Prevent CodeMirror from handling the tab.</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return true;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div>diff --git a/IPython/frontend/html/notebook/static/js/completer.js b/IPython/frontend/html/notebook/static/js/completer.js</div><div>index ac2d95c..94aff4b 100644</div><div>--- a/IPython/frontend/html/notebook/static/js/completer.js</div><div>+++ b/IPython/frontend/html/notebook/static/js/completer.js</div><div>@@ -105,8 +105,9 @@ var IPython = (function (IPython) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// we need to check that we are still on a word boundary</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// because while typing the completer is still reinvoking itself</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!/[0-9a-z._/\\:~-]/i.test(pre_cursor)) {</div><div>- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.close();</div><div>- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;</div><div>+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//this.close();</div><div>+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//return;</div><div>+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log('RTM DEBUG2');</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.autopick = false;</div></div><div><div><br></div><div><br><div><div>On Dec 18, 2012, at 1:17 AM, Matthias Bussonnier wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><p>Ah... Then it's probably the tooltip code that take over.</p><p>Same folder, codecell.js look for TAB or pre_cursor. </p><p>Completion is not triggerd if char in front of cursor is space or opening bracket.</p><p>Short from my phone.</p>
<div class="gmail_quote">Le 18 déc. 2012 09:28, "Robert McGibbon" &lt;<a href="mailto:rmcgibbo@gmail.com">rmcgibbo@gmail.com</a>&gt; a écrit&nbsp;:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>Marrhias</div><div><br></div>the baz(notevaluated).&lt;TAB&gt; <i>is</i> working in the notebook.<div><br></div><div>it's the foo(&lt;TAB&gt; that's not working... yet.</div>
<div><br></div><div>my fridge is not out of beer, so i'm still working :)</div><div><br></div><div>-Robert</div><div><br><div><div><div>On Dec 18, 2012, at 12:22 AM, Matthias BUSSONNIER wrote:</div><br><blockquote type="cite">
<div><br>Le 18 déc. 2012 à 09:03, Robert McGibbon a écrit :<br><br><blockquote type="cite">It's not working in the notebook with the argument specific completions, but the return value completion is working. There must be some issue with a difference in the line splitting with readline and without. I'll track it down.<br>
</blockquote><br>That's probably the js that removes everything between bracket by nothing<br>(IIRC, first completer was doing that.)<br><br>baz(notevaluated).&lt;tab&gt;<br>to <br>baz.&lt;tab&gt;<br><br>before completion. (or is it tooltip... that does it) <br>
<br>Or a security about 'as you type' <br><br>Actually every key press recall the completer once it has been invoked and it decide to 'kill itself' <br>on certain things (like closing bracket, spaces...) <br>
<br>That would be <br><br>IPython/frontend/html/notebook/static/js/completer.js ~L 100 smth.<br>-- <br>Matthias<br><br><br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">-Robert<br></blockquote><blockquote type="cite">
<br></blockquote><blockquote type="cite">On Dec 17, 2012, at 11:51 PM, Brian Granger wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">This looks really great. &nbsp;Have you tested it with the notebook yet? &nbsp;I<br>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite">would imagine that it should already work there as well.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite">On Mon, Dec 17, 2012 at 11:27 PM, Robert McGibbon &lt;<a href="mailto:rmcgibbo@gmail.com" target="_blank">rmcgibbo@gmail.com</a>&gt; wrote:<br></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hey,<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I just posted a new PR for annotation based custom tab completion.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite"><a href="https://github.com/ipython/ipython/pull/2701" target="_blank">https://github.com/ipython/ipython/pull/2701</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">The code is fairly complex (~1000 new lines), so I assume that there are<br></blockquote>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">bugs. For that reason (and because its fun!), I encourage people<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">to try taking it out for a spin.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">It lets you do things like this:<br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
In [1]: from IPython.extensions.completion import tab_complete, globs_to,<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">literal<br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">In [2]: @tab_complete<br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">...: def baz(x) -&gt; str:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite">...: &nbsp;&nbsp;&nbsp;&nbsp;pass<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">...:<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">In [3]: baz(notevaluated).&lt;TAB&gt;<br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">.capitalize &nbsp;.find &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.isspace &nbsp;&nbsp;&nbsp;&nbsp;.partition &nbsp;&nbsp;.rstrip &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.translate<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">.center &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.format &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.istitle &nbsp;&nbsp;&nbsp;&nbsp;.replace &nbsp;&nbsp;&nbsp;&nbsp;.split &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.upper<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
.count &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.index &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.isupper &nbsp;&nbsp;&nbsp;&nbsp;.rfind &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.splitlines &nbsp;.zfill<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">.decode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.isalnum &nbsp;&nbsp;&nbsp;&nbsp;.join &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.rindex &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.startswith<br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">.encode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.isalpha &nbsp;&nbsp;&nbsp;&nbsp;.ljust &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.rjust &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.strip<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">.endswith &nbsp;&nbsp;&nbsp;.isdigit &nbsp;&nbsp;&nbsp;&nbsp;.lower &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.rpartition &nbsp;.swapcase<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
.expandtabs &nbsp;.islower &nbsp;&nbsp;&nbsp;&nbsp;.lstrip &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.rsplit &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.title<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">And this:<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">In [4]: @tab_complete<br></blockquote></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> ...: def foo(x : globs_to('*.txt'), mode : literal('r', 'w')):<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite"> ...: &nbsp;&nbsp;&nbsp;&nbsp;pass<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> ...:<br></blockquote></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">In [5]: foo(&lt;TAB&gt;<br></blockquote>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">'COPYING.txt' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'dist/' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'setupext/'<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">'IPython/' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'docs/' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'tools/'<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
'__pycache__/' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'ipython.egg-info/'<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">'build/' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'scripts/'<br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
In[6]: foo('COPYING.txt', &lt;TAB&gt;<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">'r', 'w'<br></blockquote></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">-Robert<br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">IPython-dev mailing list<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite"><a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- <br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite">Brian E. Granger<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Cal Poly State University, San Luis Obispo<br></blockquote></blockquote>
<blockquote type="cite"><blockquote type="cite"><a href="mailto:bgranger@calpoly.edu" target="_blank">bgranger@calpoly.edu</a> and <a href="mailto:ellisonbg@gmail.com" target="_blank">ellisonbg@gmail.com</a><br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">IPython-dev mailing list<br></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">IPython-dev mailing list<br></blockquote><blockquote type="cite">
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br></blockquote><blockquote type="cite"><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</blockquote><br>_______________________________________________<br>IPython-dev mailing list<br><a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div>
_______________________________________________<br>IPython-dev mailing list<br><a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br></blockquote></div><br></div></div></div>_______________________________________________<br>IPython-dev mailing list<br><a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>http://mail.scipy.org/mailman/listinfo/ipython-dev<br></blockquote></div><br></body></html>