Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.complete() returns only %builtin methods (fix included) #11915

Open
gigaj0ule opened this issue Oct 16, 2019 · 0 comments
Open

.complete() returns only %builtin methods (fix included) #11915

gigaj0ule opened this issue Oct 16, 2019 · 0 comments

Comments

@gigaj0ule
Copy link

gigaj0ule commented Oct 16, 2019

We discovered an odd bug today where completer.complete(str) only returns %builtin methods, and not all the other things that 'tab' reveals in the terminal.

image

The above picture has no built ins, but using 'x' as the string returns:

In [39]: terminal_object.get_ipython().complete('x')[1]                                                                       
Out[39]: ['%xdel', '%xmode']

But, if you use the internal methods directly, you can get the correct behavior:

list(map(lambda x: x.name, terminal_object.get_ipython().Completer._complete(cursor_line=0, cursor_pos=len('string'), full_text='string')[3]))

The above line returns everything 'tab' normally would in the terminal for the string 'string'

Edit: This one will include function ()'s too

(lambda string: list(map(lambda x: x.name + '()' if x.type == 'function' else x.name, get_ipython().Completer._complete(cursor_line=0, cursor_pos=len(string), full_text=string)[3])))(' ')        
@gigaj0ule gigaj0ule changed the title completer.complete() returns only %builtin methods (fix included) .complete() returns only %builtin methods (fix included) Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant