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

Show better hints for namedtuple __init__() #630

Closed
ARF1 opened this issue Nov 19, 2020 · 4 comments
Closed

Show better hints for namedtuple __init__() #630

ARF1 opened this issue Nov 19, 2020 · 4 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

@ARF1
Copy link

ARF1 commented Nov 19, 2020

Environment data

  • Language Server version: 2020.11.1
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Miniconda Python 3.9

Actual behaviour

Pylance is missing argument information:
image

Note that pylance seems to already have the required information as attested by this error message:
image

Expected behaviour

Behaviour analogous to:
image

@erictraut
Copy link
Contributor

Thanks for the suggestion.

The __new__ and __init__ methods for namedtuple and NamedTuple are synthesized by pyright. The __new__ method contains all of the fields, but __init__ contains only generic *args and **kwargs. The signature help is using the __init__ method, so it's showing the less useful of the two in this case.

There are a couple of potential ways we could fix this. I'll need to think more about which one is better.

@jakebailey jakebailey added the enhancement New feature or request label Nov 19, 2020
@github-actions github-actions bot removed the triage label Nov 19, 2020
@erictraut
Copy link
Contributor

This will be fixed in the next release.

@erictraut erictraut added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Nov 21, 2020
@ARF1
Copy link
Author

ARF1 commented Nov 21, 2020

Great thank you.

@jakebailey
Copy link
Member

This issue has been fixed in version 2020.12.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020120-2-december-2020

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