-
Notifications
You must be signed in to change notification settings - Fork 767
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Support nested dictionary key completion #1493
Comments
Need to investigate why |
first one is a bug, but nested key is new feature request. so, probably we will fix the first one first, |
Our completion provider has logic for string literals but not for other literals like integers, floats, complex, etc. somedict = {
5: 0,
3.41: 0,
3j: 0,
[3, 4]: 0,
} We'll need to decide where to draw the line. The vast majority of keys within dicts are strings. It drops off very quickly after that. Integers are probably next. |
@erictraut I agree with you. |
@erictraut I have to explain that in your example, the last key [3, 4] is invalid because it's mutable. See the reasons https://docs.python.org/3/faq/design.html#why-must-dictionary-keys-be-immutable |
Yes, good point. Replace the list with a tuple. |
Moving this issue to discussion as an enhancement request for comments and upvotes. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Environment data
Expected behaviour
Pylance should show key completion for integer and nested keys.
Actual behaviour
Pylance does not show key completion for integer and nested keys.
Logs
Code Snippet / Additional information
Pylance does not show key completion for integer keys (in this case 5)
![image](https://user-images.githubusercontent.com/7765309/123192709-b2934900-d4b8-11eb-86d2-da4a2241de05.png)
Pylance does not show key completion for nested keys
![image](https://user-images.githubusercontent.com/7765309/123192762-c939a000-d4b8-11eb-8d0e-6477b84a4389.png)
The text was updated successfully, but these errors were encountered: