You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Use python 3.6 interpreter ("Python 3.6.6" from Anaconda). It works
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
This is b/c internally expression is extracted and parsed as annotation but since parser is created off current configuration it is 2.7 and hence is unable to parse type annotations. The fix is to always parse hints as 3.x.
I did a quick step through of the source, it's constructing the fragment x: int to pass to the parser which then fails this check:
Parser.cs:918 if (PeekToken(TokenKind.Colon) && (_stubFile || _langVersion >= PythonLanguageVersion.V36)) {
It's explicitly checking the python version there.
Using the Parser option StubFile causes it to succeed and the type is now correct in vscode, but I'm unsure if this is the correct fix.
Activity
MikhailArkhipov commentedon May 14, 2019
This is b/c internally expression is extracted and parsed as annotation but since parser is created off current configuration it is 2.7 and hence is unable to parse type annotations. The fix is to always parse hints as 3.x.
makzimus commentedon May 14, 2019
I did a quick step through of the source, it's constructing the fragment
x: intto pass to the parser which then fails this check:Parser.cs:918
if (PeekToken(TokenKind.Colon) && (_stubFile || _langVersion >= PythonLanguageVersion.V36)) {It's explicitly checking the python version there.
Using the Parser option
StubFilecauses it to succeed and the type is now correct in vscode, but I'm unsure if this is the correct fix.MikhailArkhipov commentedon May 14, 2019
The fix was to always parse annotation fragment as 3.6+ rather than as currently set Python.
makzimus commentedon May 14, 2019
I just scrolled up after I posted! Awesome, good work.