Skip to content

Autocomplete for dictionary keys #226

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

Closed
ikanobori opened this issue Jul 4, 2014 · 5 comments
Closed

Autocomplete for dictionary keys #226

ikanobori opened this issue Jul 4, 2014 · 5 comments

Comments

@ikanobori
Copy link
Contributor

How hard would be adding such autocomplete for dict keys?

#!python

>>> dic = {'key1': 1, 'key2': 2, 3: 333, an_object: 4}
>>> dic[
┌───────────────────────────────────
│ 'key1'    'key2'   3    an_object
└───────────────────────────────────

@ikanobori
Copy link
Contributor Author

PR merged.


Original Comment By: Sebastian Ramacher

@ikanobori
Copy link
Contributor Author

Awesome! Nick and I thought it was undoable at the time!


Original Comment By: Dwayne Jones

@ikanobori
Copy link
Contributor Author

Fixed by Maja's pull request, though as mentioned in PR notes eventually it'd be great to have it do narrowing completion.


Original Comment By:

@ikanobori
Copy link
Contributor Author

an_object is the hard part - traversing the current namespace for references to an object feels ridiculous. But 'key1 seems pretty reasonable, as Dwayne says.


Original Comment By:

@ikanobori
Copy link
Contributor Author

We looked into this and it seems we'd need to change the Repl class's complete function. Currently, complete returns False and bails if current_str ing and cw are empty. On line 583 and/or 564, we could have a new case for handling when a '[' is entered.


Original Comment By: Dwayne Jones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant