[IPython-dev] greedy completer breaks useful completions - fixable?
Mon Apr 2 16:55:44 CDT 2012
On Mon, Apr 2, 2012 at 15:46, Zachary Pincus <firstname.lastname@example.org>wrote:
> Hi all,
> The normal ipython tab-completer is pretty useful in that one can do
> things like:
> to get a list of b's attributes while writing out the function call.
> will list the documents in the cwd.
> However, after enabling the "greedy completer", very useful in its own
> right, this behavior goes away. e.g.
> gives nothing.
> This comes down to the difference between DELIMS and GREEDY_DELIMS in
> Is there any way that the greedy completer could have a larger set of
> delimiters? Though, in some sense the current GREEDY_DELIMS is already too
> large a set, as it includes the space char, which causes the following
> def a(b,c): return b+c
> a('a','b').[TAB] # works
> a('a', 'b').[TAB] # doesn't work -- the space breaks the completer.
> Is there any to make the greedy completer to be a bit smarter without it
> having to be a full python parser? Maybe some logic about what to do with
> balanced vs. unbalanced parens/braces might be appropriate? This sort of
> thing would fix both of the problems above.
> If people agree this is feasible, I could look into a patch, but I'm
> curious if anyone's tried/failed at this before...
This should absolutely be doable, and the current behavior should be
considered a bug. I think greedy completion should produce a strict
superset of the completions from the regular competer. The simplest way to
guarantee that this happens might be to *not* replace the completer like we
do, but call the original completer, then call a *different* one that only
does the item-completion, and merge the results.
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev