-
Notifications
You must be signed in to change notification settings - Fork 767
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
Provide key completions for TypedDict dictionaries #827
Comments
I think this may be a dupe of #654. |
Not entirely, as that's for building the dict; this is for getting values from it. I'm surprised we don't do this, but I guess this is a string literal completion in |
Yep, it's completing to a string in an index context and subtly different from #654 for the reasons you listed. |
This feature is already implemented, but the usability is not great currently. The problem is that the suggestion is provided only when you type the first quote character, but the client doesn't automatically trigger a suggestion request at that point. If you place the cursor between the Any suggestions for how to improve the usability here? |
We do declare that I think what would be an improvement would be at that point to quite literally offer up the string literals as full completions, rather requiring that a user types a quote. For example, TS does something like this: |
(The above is an example of making the object, so that's really #654, but I just mean to point at the completion itself.) |
Yeah, that's a good suggestion. I just checked in a change that implements this. |
A gotcha is which quote character to choose; I think TS probably scans the file to figure out the predominant one to offer. I don't see the commit yet on pyright, but I'll take a look once it's there. |
Pyright also chooses the predominant quote in the document. |
Slightly curious which completion item kind is being used; TS has that horizontal line icon while we have the EDIT: It's |
Yeah, the use of As for which quotes to use by default, best I can tell you is Black defaults to |
My preference would be to swap this to Reading the quote character, the parser seems to count and then have a boolean of |
This issue has been fixed in version 2021.1.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202111-13-january-2021 |
E.g., for the following code:
I would expect to be able to get a completion from within
arg[]
as the possible set of keys are known.The text was updated successfully, but these errors were encountered: