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

Support hint for inline if statement #3635

Closed
ZeroRin opened this issue Nov 16, 2022 · 2 comments
Closed

Support hint for inline if statement #3635

ZeroRin opened this issue Nov 16, 2022 · 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

@ZeroRin
Copy link

ZeroRin commented Nov 16, 2022

Consider typing the following code in VSCode

foo = True
bar = 1 if foo else 0

There will be no hint available when typing foo
image

Also, the typed foo will not be recognized as variable until the statement after else is written
image

@erictraut
Copy link
Contributor

I've improved the parser's error recovery in this case so it creates a TernaryNode (with error subnodes) when it is discovers a partial ternary expression. This provides the completion provider with sufficient parse information to supply completion suggestions in this circumstance.

erictraut pushed a commit to microsoft/pyright that referenced this issue Nov 16, 2022
@erictraut erictraut added enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage-needed labels Nov 16, 2022
@rchiodo rchiodo closed this as completed Nov 17, 2022
@rchiodo
Copy link
Contributor

rchiodo commented Nov 17, 2022

This issue has been fixed in prerelease version 2022.11.31, which we've just released. You can find the changelog here: CHANGELOG.md

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