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

Suggest __future__ module as import option #539

Closed
cdce8p opened this issue Oct 29, 2020 · 2 comments
Closed

Suggest __future__ module as import option #539

cdce8p opened this issue Oct 29, 2020 · 2 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

@cdce8p
Copy link

cdce8p commented Oct 29, 2020

Environment data

  • Language Server version: 2020.10.3
  • OS and version: macOS
  • Python version: 3.9

Expected behaviour

Typing from __ or import __ I would expect to see the __future__ module as an option.

Actual behaviour

Only the Code snipped __main__ (which makes no sense in the context of an import) and modules with one leading underscore are suggested.
Note: Although not displayed in the screenshot, __future__ is not even suggested in the scroll list.

Screen Shot_Future_import

Logs

XXX

Code Snippet / Additional information

Example usage

from __future__ import annotations
@jakebailey
Copy link
Member

jakebailey commented Oct 29, 2020

__future__ is handled specially in the parser and type checker, but it's likely not being added as a valid module choice in the completion provider. Would make sense to include.

Regarding the __main__ import, that's a snippet that's attemping to include the __name__ == "__main__" pattern; those are provided by the Python extension and we don't have much control over those. (Personally, I disable snippets altogether because they simply aren't powerful enough to understand the code context. They're basically loose regex.)

@jakebailey jakebailey added the enhancement New feature or request label Oct 29, 2020
@github-actions github-actions bot removed the triage label Oct 29, 2020
@erictraut erictraut added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Nov 16, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.11.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020112-18-november-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