<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, 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(<TAB>.</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, </div><div>You could set         </div><div>this.tooltip_on_tab = true;</div><div>L25 in codecell.js to false. </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. </div><div><br></div><div>It should be made configurable. </div><div><br></div><div>we could try to tweak the behavior so that (<tab> trigger tooltip</div><div>([space]<tab> trigger completion.</div><div><br></div><div>But I guess that's beyond the extend of your PR.</div><div>-- </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>        # FIXME: we should extend our api to return a dict with completions for</div><div>        # different types of objects.  The rlcomplete() method could then</div><div>        # simply collapse the dict into a list for readline, but we'd have</div><div>        # 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>                 IPython.tooltip.request(that);</div><div>                 // Prevent the event from bubbling up.</div><div>                 event.stop();</div><div>+                console.log('RTM DEBUG');</div><div>+                this.completer.startCompletion();</div><div>                 // Prevent CodeMirror from handling the tab.</div><div>                 return true;</div><div>             } 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>         // we need to check that we are still on a word boundary</div><div>         // because while typing the completer is still reinvoking itself</div><div>         if (!/[0-9a-z._/\\:~-]/i.test(pre_cursor)) {</div><div>-            this.close();</div><div>-            return;</div><div>+            //this.close();</div><div>+            //return;</div><div>+            console.log('RTM DEBUG2');</div><div>         }</div><div> </div><div>         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" <<a href="mailto:rmcgibbo@gmail.com">rmcgibbo@gmail.com</a>> a écrit :<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).<TAB> <i>is</i> working in the notebook.<div><br></div><div>it's the foo(<TAB> 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).<tab><br>to <br>baz.<tab><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.  Have you tested it with the notebook yet?  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 <<a href="mailto:rmcgibbo@gmail.com" target="_blank">rmcgibbo@gmail.com</a>> 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) -> str:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">
<blockquote type="cite">...:     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).<TAB><br></blockquote></blockquote>
</blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">.capitalize  .find        .isspace     .partition   .rstrip      .translate<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">.center      .format      .istitle     .replace     .split       .upper<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
.count       .index       .isupper     .rfind       .splitlines  .zfill<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">.decode      .isalnum     .join        .rindex      .startswith<br>
</blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">.encode      .isalpha     .ljust       .rjust       .strip<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">.endswith    .isdigit     .lower       .rpartition  .swapcase<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
.expandtabs  .islower     .lstrip      .rsplit      .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"> ...:     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(<TAB><br></blockquote>
</blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">'COPYING.txt'        'dist/'              'setupext/'<br></blockquote></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite"><blockquote type="cite">'IPython/'           'docs/'              'tools/'<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">
'__pycache__/'       'ipython.egg-info/'<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">'build/'             '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', <TAB><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>