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

Support PEP comment type hints #7

Closed
MikhailArkhipov opened this issue Aug 31, 2018 · 5 comments · Fixed by #546
Closed

Support PEP comment type hints #7

MikhailArkhipov opened this issue Aug 31, 2018 · 5 comments · Fixed by #546
Assignees
Labels
Milestone

Comments

@MikhailArkhipov
Copy link

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

@technic
Copy link

technic commented May 11, 2019

It doesn't work for python 2.7.

@MikhailArkhipov
Copy link
Author

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

@technic
Copy link

technic commented May 11, 2019

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

@makzimus
Copy link

makzimus commented May 14, 2019

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.

@MikhailArkhipov
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants