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

TypedDict completions after first don't appear without quotes #1920

Closed
jakebailey opened this issue Oct 8, 2021 · 3 comments
Closed

TypedDict completions after first don't appear without quotes #1920

jakebailey opened this issue Oct 8, 2021 · 3 comments
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@jakebailey
Copy link
Member

@jakebailey Unfortunately, it only works for the first key. After that pylance reports an error (missing key) and no suggestions are offered.

from typing import TypedDict

class PointTD(TypedDict):
    x: int
    y: int

p1: PointTD = {'x': 1, }

Screen Shot 2021-10-08 at 21 12 07

Originally posted by @cdce8p in #654 (comment)

@github-actions github-actions bot added the triage label Oct 8, 2021
@jakebailey
Copy link
Member Author

Adding quotes makes it work:

image

@erictraut
Copy link
Contributor

The logic wasn't properly handling the case where there was no quote but there was already at least one dictionary entry. Handling this properly required the parser to provide a bit more information (in particular, the presence of a hanging comma token). I've updated the logic to handle this case.

@erictraut erictraut added enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Oct 9, 2021
@bschnurr
Copy link
Member

bschnurr commented Oct 14, 2021

This issue has been fixed in version 2021.10.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#2021101-14-october-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants