[IPython-dev] function specific tab completion via annotations
Matthias Bussonnier
bussonniermatthias at gmail.com
Tue Dec 18 04:17:24 EST 2012
Ah... Then it's probably the tooltip code that take over.
Same folder, codecell.js look for TAB or pre_cursor.
Completion is not triggerd if char in front of cursor is space or opening
bracket.
Short from my phone.
Le 18 déc. 2012 09:28, "Robert McGibbon" <rmcgibbo at gmail.com> a écrit :
> Marrhias
>
> the baz(notevaluated).<TAB> *is* working in the notebook.
>
> it's the foo(<TAB> that's not working... yet.
>
> my fridge is not out of beer, so i'm still working :)
>
> -Robert
>
> On Dec 18, 2012, at 12:22 AM, Matthias BUSSONNIER wrote:
>
>
> Le 18 déc. 2012 à 09:03, Robert McGibbon a écrit :
>
> 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.
>
>
> That's probably the js that removes everything between bracket by nothing
> (IIRC, first completer was doing that.)
>
> baz(notevaluated).<tab>
> to
> baz.<tab>
>
> before completion. (or is it tooltip... that does it)
>
> Or a security about 'as you type'
>
> Actually every key press recall the completer once it has been invoked and
> it decide to 'kill itself'
> on certain things (like closing bracket, spaces...)
>
> That would be
>
> IPython/frontend/html/notebook/static/js/completer.js ~L 100 smth.
> --
> Matthias
>
>
>
>
> -Robert
>
>
> On Dec 17, 2012, at 11:51 PM, Brian Granger wrote:
>
>
> This looks really great. Have you tested it with the notebook yet? I
>
> would imagine that it should already work there as well.
>
>
> On Mon, Dec 17, 2012 at 11:27 PM, Robert McGibbon <rmcgibbo at gmail.com>
> wrote:
>
> Hey,
>
>
> I just posted a new PR for annotation based custom tab completion.
>
> https://github.com/ipython/ipython/pull/2701
>
>
> The code is fairly complex (~1000 new lines), so I assume that there are
>
> bugs. For that reason (and because its fun!), I encourage people
>
> to try taking it out for a spin.
>
>
>
> It lets you do things like this:
>
>
> In [1]: from IPython.extensions.completion import tab_complete, globs_to,
>
> literal
>
>
> In [2]: @tab_complete
>
> ...: def baz(x) -> str:
>
> ...: pass
>
> ...:
>
>
> In [3]: baz(notevaluated).<TAB>
>
> .capitalize .find .isspace .partition .rstrip .translate
>
> .center .format .istitle .replace .split .upper
>
> .count .index .isupper .rfind .splitlines .zfill
>
> .decode .isalnum .join .rindex .startswith
>
> .encode .isalpha .ljust .rjust .strip
>
> .endswith .isdigit .lower .rpartition .swapcase
>
> .expandtabs .islower .lstrip .rsplit .title
>
>
>
> And this:
>
>
> In [4]: @tab_complete
>
> ...: def foo(x : globs_to('*.txt'), mode : literal('r', 'w')):
>
> ...: pass
>
> ...:
>
>
> In [5]: foo(<TAB>
>
> 'COPYING.txt' 'dist/' 'setupext/'
>
> 'IPython/' 'docs/' 'tools/'
>
> '__pycache__/' 'ipython.egg-info/'
>
> 'build/' 'scripts/'
>
>
> In[6]: foo('COPYING.txt', <TAB>
>
> 'r', 'w'
>
>
>
>
> -Robert
>
>
> _______________________________________________
>
> IPython-dev mailing list
>
> IPython-dev at scipy.org
>
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
>
>
> --
>
> Brian E. Granger
>
> Cal Poly State University, San Luis Obispo
>
> bgranger at calpoly.edu and ellisonbg at gmail.com
>
> _______________________________________________
>
> IPython-dev mailing list
>
> IPython-dev at scipy.org
>
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
> _______________________________________________
>
> IPython-dev mailing list
>
> IPython-dev at scipy.org
>
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20121218/496fe686/attachment.html>
More information about the IPython-dev
mailing list