-
Notifications
You must be signed in to change notification settings - Fork 768
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
False "code is unreachable" #794
Comments
Please refer to #470 |
Sorry, I tried looking for "sys.platform" and I didn't search for "os.name". |
@erictraut I tried it and I don't find it as a good solution. Please make another option for "Any" so the sys.os / sys.platform won't show a warning, it is very confusing since the code works as I expect it and I just need to ignore this warning. Would be appreciated. |
You won't see a warning for unreachable code. You will simply see that some code is "grayed out". If you're seeing a warning, then something else is wrong, and we should investigate that. |
I've changed "pythonPlatform" to accept a value of "All". When it receives this configuration value (or any other string value that it doesn't understand), it will assume that all platforms are supported. So that should eliminate the "grayed out" code in this case. If you are seeing an actual warning, please let me know because that shouldn't happen. |
@erictraut by warning I mean grayed out, there isn't an actual warning of course. This is the json configuration file
I'm running from windows. |
Yeah, I just checked in the change for "All". You won't see the updated behavior until the next release of pylance. |
Ok got it. Thank you very much! |
The above change is in 2021.1.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202110-6-january-2021 |
When you write a python code like the following:
It marks the code as "unreachable" depends on whether you are writing in Linux or Windows.
I believe the warning shouldn't appear on that case.
The text was updated successfully, but these errors were encountered: