False "code is unreachable"
When you write a python code like the following:
if sys.platform == 'win32':
#some code here
else:
# some other code
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.
Please refer to https://github.com/microsoft/pylance-release/issues/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.
I can understand from your comment on #470 that this is intended but consider it as a feature request.
When I used {"pythonPlatform": "All"} it just swaps the unreachable part between the 'if' and 'else' statements.
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. Thank you
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.
I'm experiencing something different than your description.
This is what I get when I use "All"

This is the json configuration file
{
"pythonPlatform": "All"
}
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