-
Notifications
You must be signed in to change notification settings - Fork 767
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
Pylance reports "Invalid character in token" but character is valid #1286
Comments
Thanks for the bug report. Pylance supports unicode characters in general, but it doesn't currently support "supplementary characters" that extend the UTF16 Unicode character set. The character above falls into that category. It uses the "surrogate" character 0xD800 followed by a second 16-bit value to encode the "𐌎" symbol, which is character in the "old italic" character set (from a dead language). We'll need to add support for these supplementary characters in the pyright tokenizer so it properly handles the complete "Lo" character set, which PEP 3131 indicates is supported for identifiers. |
This will be addressed in the next release. |
Is there any way I can disable the warning for now? |
There's no way to disable the warning short of disabling pylance. You can work around it by choosing identifier names that don't rely on supplementary characters. Out of curiosity, why are you using characters from dead languages in your variable names? I know that it's supported by Python, but it doesn't seem to be a good idea for code readability. We typically release a new version of pylance each week, so you won't have to wait long for the fix. |
My brain parses single characters more easily than words. I wouldn't do it on a team project, but for my own code it makes a big difference. This code generates a file I work from:
There's also https://www.asmeurer.com/python-unicode-variable-names/continue-characters.html |
This issue has been fixed in version 2021.5.3, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202153-19-may-2021 |
Hi! I am still having this issue (VSCode version is 1.58.2) with Jupyter Notebook cells running shell scripts via |
That's unrelated; see #1579 (comment) and https://github.com/microsoft/vscode-jupyter/issues/6635. |
New version of this plugin uses PyLance, which compains here:
But this is a valid character:
ref: https://www.asmeurer.com/python-unicode-variable-names/ -- this links to a list of all valid characters for variable names
The text was updated successfully, but these errors were encountered: