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
Custom dict completion with _ipython_key_completions_ should allow access to prefix string #12420
Comments
@meeseeksdev tag tab-completion |
I have a use case where I would love to be able to do this - a tree-like xarray data structure which can be indexed with file-like paths, e.g. For path segments like
would work for me. |
Looking inside the ipython completer, it seems there is already a This is available internally before Could we simply pass |
I would love to be able to use dictionary completion to implement a quick-search style feature. It looks as though currently I can implement the ipython_key_completions method, but it does not receive any information about what has been typed after the opening square braces.
Could we have a way to receive the prefix string in the ipython_key_completions method?
Something like:
my_object['str <tab>
causes
_ipython_key_completions_(prefix: str)
to be triggered, whereprefix == 'str'
I looked into implementing a custom completer, but couldn't work out how to associate the line context with MyClass without some AST magic. Is there a simple recipe to implement more general completion for dict keys?
The text was updated successfully, but these errors were encountered: