Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Support PEP comment type hints #7

Description

microsoft/PTVS#3917

https://www.python.org/dev/peps/pep-0484/
https://www.python.org/dev/peps/pep-0526/

PEP_526_style: str = "hello world"
captain: str  # Note: no initial value!
PEP_484_style = SOMETHING # type: str

 
PEP_484_style.
PEP_526_style.upper()
captain.upper()

Type declaration is not recognized as string.

image

Jedi

image

Related: microsoft/PTVS#3674

Activity

  1. technic commented on May 11, 2019

    @technic

    It doesn't work for python 2.7.

  2. MikhailArkhipov commented on May 11, 2019

    @MikhailArkhipov
    Author

    What does not work exactly? Could you give sample of the code?

  3. technic commented on May 11, 2019

    @technic

    What does not work exactly? Could you give sample of the code?

    1. Go to vscode settings and disable jedi.
    2. Create new folder and open it
    3. Use python 3.6 interpreter ("Python 3.6.6" from Anaconda). It works
      image
    4. Use python 2.7 interpreter ("Python 2.7.16" from Anaconda). It does not work, no popup :(
      if I do y = 3 then it deduces type to int and I see the popup completion again
  4. makzimus commented on May 14, 2019

    @makzimus

    I can confirm the absence of type hints in the above example.
    Trace output doesn't seem helpful, but included for posterity:

    Analysis of main(User) queued
    Analysis version 9 of 1 entries has started.
    Analysis of main(User) completed in 0.1192 ms.
    Analysis version 9 of 1 entries has been completed in 0.1974 ms.
    Completions in file:////main.py at (2, 5)
    Completions in file:////main.py at (2, 6)
    Analysis of main(User) queued
    Analysis version 10 of 1 entries has started.
    Analysis of main(User) completed in 0.1932 ms.
    Analysis version 10 of 1 entries has been completed in 0.3502 ms.

  5. MikhailArkhipov commented on May 14, 2019

    @MikhailArkhipov
    Author

    Since this issue is closed, I opened #1073 for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions