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

Type 'None' not getting colorization properly #1039

Closed
BrunoBlanes opened this issue Mar 12, 2021 · 6 comments
Closed

Type 'None' not getting colorization properly #1039

BrunoBlanes opened this issue Mar 12, 2021 · 6 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@BrunoBlanes
Copy link

Environment data

  • Pylance Type Checking Mode: basic
  • Language Server version: 2021.3.2-pre.1
  • OS and version: Windows 10 Pro Insider Preview Build 21313
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.7 64-bit

Expected behaviour

Expected type 'None' to still be colored blue despite the single quotes.

Actual behaviour

'None' gets colored as a string and the same goes for the vertical bar that separates types.

image

@judej judej added the bug Something isn't working label Mar 15, 2021
@github-actions github-actions bot removed the triage label Mar 15, 2021
@judej
Copy link
Contributor

judej commented Mar 15, 2021

Thanks for the report. This looks like a bug and we will investigate.

thanks!

@BrunoBlanes
Copy link
Author

Would it be possible to get the vertical bar and brackets to also turn white?

@jakebailey
Copy link
Member

We tokenize names, and then leave the other tokens up to the editor to color (in this case, they get the string literal color). What you're calling "white" is actually just the "unknown" token type when shown in regular code, i.e. what you get if you just open a new file with no language and start typing.

Changing that behavior would be a separate enhancement we could consider, as we've designed it to work the current way (versus None not being colored is a bug; None is a name).

@BrunoBlanes
Copy link
Author

Ah cool, thanks for explaining!

@jakebailey
Copy link
Member

The next release adds a new token for the builtin constants True, False, None, and __debug__, so they should be colored identically in all places where they are present.

@jakebailey jakebailey added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Aug 30, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.7.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202190-1-september-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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